BookmarkSubscribeRSS Feed
KevinQin
Obsidian | Level 7
Hi,
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. 😞

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;
run;

ods html close; Message was edited by: Kevin Qin
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.

ftp://ftp.sas.com/techsup/download/hotfix/e9_win_sbcs.html
KevinQin
Obsidian | Level 7
Hi,
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.

-Kevin
Cynthia_sas
Diamond | Level 26
Hi:
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:
http://mailformat.dan.info/body/html.html

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).
[pre]
/*
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';
run;

ods html close;

filename doemail email
to=('person1@comcast.net' 'person2@sas.com' 'person3@sas.com')
from='me.myself_and_I@sas.com'
cc=('person4@gmail.com' 'person5@sas.com')
subject='Testing attach of ODS html output'
attach='c:\temp\class.html';

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

[/pre]

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2888 views
  • 0 likes
  • 3 in conversation