Sending email containing HTML that is generated with ODS can be done within SAS using several methods. The first method is to send the HTML directly without creating an intermediate file. For this method to work successfully so that the email is rendered appropriately, the -EMAILSYS option must be set to SMTP. In addition, the -EMAILHOST option must specify the Simple Mail Transport Protocol (SMTP) server that supports email access for your site.
Here is an example of Method 1:
filename temp email to="person@company.com"
subject="Testing the e-mail interface"
type="text/html";
ods html body=temp;
proc print data=sashelp.class;ods html close;
The second method sends HTML files as attachments using the FILENAME statement with the EMAIL device. This method does not require SMTP as the mail server.
Here is an example of Method 2:
ods html path='c:\test\' file='temp.html';
proc print data=sashelp.class;ods html close;
filename doemail email to='person@company.com'
subject='Testing attachment of HTML'
attach='c:\test\temp.html';
data _null_;
file doemail;
put 'This is a test';
run;