Hi all. Just curious if anybody has a more efficient way than the method I'm using to create web pages and email them. What I do is this. I'll have a macro with an ODS HTML statement that generates an html file based on a series of proc reports. I'll then run the same macro a second time, but with a different parameter that points the "body" to send an email instead of create a file. At the end of the job, I call an FTP program to upload the file to an offsite webserver.
So, basically, I'm executing everything twice. Is there a simpler way to send an html email based on an existing html file? Thanks for any suggestions.
My favorite method for sending email is to send the report as an attachment using code something like this:
** step 1: make the report;
ods html body='c:\temp\class.html style=sasweb;
proc print data=sashelp.class;
title 'Emailed This ODS HTML File';
ods html close;
** step 2: email the report with an explanatory note;
filename doemail email
subject='Testing attach of ODS HTML output'
put 'This is a test email with the report as an attachment. ';
put 'The report will be on the web server tomorrow';
The advantage of this method is that you could (if you had write access to the web server) write the file directly to the web server. In your case, since you are FTP'ing the file to the web server -- you could create one copy of the report in your FTP location and then email -that copy- as the attachment. You'd only create the file one time.
ps...if you search support.sas.com, there are a lot of hits on emailing with SAS and I believe there are also several SUGI and SGF papers on the topic, too.
I am also trying to send files via email and it works when I use internal email id's but I get errors when I insert email id's for external customers. Do I need to change my code to send to outside users??? Thanks,,
Using my mail server, I AM able to send emails to external customers. You may need to check with your mail administrators on this one. There's nothing in the SAS program that prevents you from using an external email address. And then SAS just passes the addresses to whichever email server was defined as being the one to use. If there's a different server that allows external email IDs, then you'd have to get your SAS session pointed to that server.
Our email administrators keep us on our toes, as from time to time our emails from z/OS stop getting through. The latest issue was having to code the FROM parameter (as in Cynthia’s example) so that the server knows it’s coming from an internal address. (Our TCP/IP and SMTP parameters suggest otherwise.)