The SAS Output Delivery System and reporting techniques

Why is the html email plain html code?

Posts: 43

Why is the html email plain html code?

I get into trouble when sending html email from SAS (9.1.3 PC version).
It is very strange that the email content is plain html code.
How can I fix it? I searched SAS-L and SUGI and find no answer. Smiley Sad

Would you please help me out?

Below are my code:

FILENAME output EMAIL SUBJECT= "Sales summary report 1" TO= "address@emailsite>" CONTENT_TYPE="text/html";

ods html file=output;

proc print data=sashelp.class;

ods html close; Message was edited by: Kevin Qin
Super Contributor
Super Contributor
Posts: 3,176

Re: Why is the html email plain html code?

I tested very similar code on Windows and also on IBM z/OS mainframe, both are at SAS 9.1.3 Service Pack 4. The results are different -- Windows generates an EMAIL that is treated as text-format, not HTML, as you explained. I sent the same EMAIL from the IBM mainframe environment, and the EMAIL client read the content correctly, showing the HTML-rendered output.

So, I do not have time to test it, but there is a SAS HOTFIX (maintenance) Bundle that applies on top of SAS 9.1.3 SP4 (HOTFIX E9BC05 for Windows, incorporated into HOTFIX bundle E9BX03, dated Mar 2008), and I do see where several SMTP mail issues are addressed (link to SAS support site provided below). You may want to investigate the maintenance, or possibly contact SAS support for more specific guidance, possibly even a circumvention.

Scott Barry
SBBWorks, Inc.
Posts: 43

Re: Why is the html email plain html code?

Thank you for your reply.
I have installed E9BX03 hotfix. However, it still fail with plain HTML code.

I have a try by changing Emailsys system option from MAPI to SMTP, it works.
So I can infer that this is a bug about -Emailsys MAPI.

Posts: 9,365

Re: Why is the html email plain html code?

I'm not sure that it's a SAS issue at all. Some email servers can be configured to send plain text only -- in fact, some email administrators disable the creation of either sending or receiving HTML files in favor of sending and receiving plain text only.

This web site has an interesting discussion of the pros/cons of plain text vs HTML and some history on the issue:

One thing that I frequently do is send a mail message in plain text format, but then send my report as an attachment in HTML form (or RTF form or PDF form).
This method sends the HTML files as attachments using
the FILENAME statement with the EMAIL device. This method
does not require SMTP as the mail server.
It does popup the Outlook box on windows.

ods html body='c:\temp\class.html' style=sasweb;

proc print data=sashelp.class;
title 'Emailed This ODS HTML File';

ods html close;

filename doemail email
to=('' '' '')
cc=('' '')
subject='Testing attach of ODS html output'

data _null_;
file doemail;
put 'This is a test email with attachment.';
put 'It is the ABC Report in HTML format.';
put 'Thanks!';


Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation