BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
My favorite method for sending email is to send the report as an attachment using code something like this:
[pre]

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

ods html close;

** step 2: email the report with an explanatory note;

filename doemail email
to=('One.Person@sas.com' 'another.person@sas.com')
from='Me@sas.com'
cc=('You@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 the report as an attachment. ';
put 'The report will be on the web server tomorrow';
run;

[/pre]

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.

cynthia

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.
deleted_user
Not applicable
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,,
Cynthia_sas
SAS Super FREQ
Hi:
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.

cynthia
deleted_user
Not applicable
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.)

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 655 views
  • 0 likes
  • 2 in conversation