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.
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.
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.
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=('firstname.lastname@example.org' 'email@example.com' 'firstname.lastname@example.org')
subject='Testing attach of ODS html output'
put 'This is a test email with attachment.';
put 'It is the ABC Report in HTML format.';