Reputation: 1537
This is the original code.
filename outmail email type='text/html'
subject='see this'
from="..."
to="..."
attach=("\...\a.pdf"content_type="application/pdf");
ods _all_ close;
ods listing close;
ods html body=outmail style=minimal;
title1 'AAA';
title2 'BBB';
proc tabulate data=
...
run;
ods html close;
ods listing;
But now I don't want to show a tabulated output in the email body, so I remove this part from the original code.
proc tabulate data=
...
run;
The problem is I won't have titles in the email any more. It seems I have to put some proc
in the code to make titles exist in the email. But I don't want to show anything in the email body except
Hi all,
Regards,
Balala
Update
I tried this but no luck.
filename outmail email type='text'
subject="AAAA"
from="..."
to="..."
attach=("\\...\text.pdf" content_type="application/pdf");
data _null_;
file outmail;
put 'Hi all,';
put 'First line';
put 'Second line ';
put ' ';
put 'Regards,';
put 'Balala';
run;
But in the email, it shows Hi all,First lineSecond line Regards,Balala
.
Update2
The 2nd option doesn't work for me. 1st option doesn't work at first, but when I restart SAS session, it works. But I haven't changed any setting.
And interestingly, I change the type to text/plain
instead of text
or text/html
then everything works fine
Upvotes: 1
Views: 8750
Reputation: 1449
You have two options there.
Options 1: HTML tags
Specify HTML tags in your email if you are doing content_type="text/html"
Example:
filename mailbox email '[email protected]' subject='test email' content_type="text/html";
data _null_;
file mailbox;
put "<body>";
put "<p>Hello,</p>" ;
put "<p>Test email sent <br> Regards,</p>" /
'Automated SAS Code';
put "</body>";
RUN;
Options 2 "Backslash" pointer:
Specify backslash at the end of the line to make the pointer to go over the line. Beware of what Quentin pointed in the comments, you could end up with double lines. Depends on the your SAS platform and email server. Documented here (search for in the document "/"): http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000161869.htm
filename mailbox email '[email protected]' subject='test email';
data _null_;
file mailbox;
put "Hello," /;
put "Test email sent. "/;
put "Regards," /;
put "Automated SAS Code";
RUN;
Regards, Vasilij
Upvotes: 3