The SAS Output Delivery System and reporting techniques

How To Attach a webpage on my email?

Reply
Frequent Contributor
Posts: 78

How To Attach a webpage on my email?

Hi All,

I have just created a HTML page call Test.Htm which contains four line graphs.

I am using SAS to automate an email with the html page attached to it and send it to my manager monthly. So that when he opens up the email, it will just show the content of the html (showing all the graphs). This is my script so far...

FILENAME Finnote EMAIL TO = "ABC@Edgecorp.com.au"
SUBJECT = "Monthly Sales Report & Graphs";
DATA _NULL_;
FILE Finnote;
PUT '???????????? ';
PUT '????????????? ';
RUN;

I undestand that this will only automate the email however, it does not attach the webpage on the email.

Hoping someone can help out ! Smiley Sad

Cheers
Yennie
SAS Super FREQ
Posts: 8,743

Re: How To Attach a webpage on my email?

Hi:
If you search support.sas.com using the string
ODS HTML email
you will come up with a lot of hits. This is just one of them:
http://support.sas.com/kb/6/735.html

For what you're doing (HTML page with graphs), you will probably want to use the second method and use ATTACH=
for the HTML page (and remember that if you have created the type of HTML page with <IMG> tags you'll also need to attach the image files).

I do recommend that you search on support.sas.com, as there are some configuration options that you may need to have your SAS administrator set so you can use the EMAIL method.

cynthia
Super Contributor
Super Contributor
Posts: 3,174

Re: How To Attach a webpage on my email?

Personally have been unsuccessful with packaging an EMAIL with attachments, containing a combination of related "files" (HTML, GIF or other image files) that comprise a "webpage". It's definitely possible, but the recipient must first save all of the attachments to a file-directory location, and then launch the primary "index" page. An example would be one where there is a combination of SAS-generated FRAME/CONTENTS HTML documents and also graphic-image files to render as part of the "webpage".

A better approach I found was to generate the web-publishing content to a web-server location, and then send an EMAIL with an imbedded link to the prmary page.


Scott Barry
SBBWorks, Inc.
SAS Super FREQ
Posts: 8,743

Re: How To Attach a webpage on my email?

Hi:
I agree. It is sort of a pain to try to keep all the files together. One solution in SAS 9.2 is to use ODS PACKAGE destination to make a zip archive of all the files you need for a job and then to email the zip archive as the attachment. Of course, you have to be able to send and your recepients need to be able to receive zip files, but that is an alternative.

There's some 9.2 code below to test. You would then use the .ZIP file name with the ATTACH= option for EMAIL and all the files created for ODS HTML -- the main file and all the image files will be together.

cynthia
[pre]

ods listing close;
ods package open;
ods html package file="allstuff.html" style=analysis;

*** proc gchart or other SAS/GRAPH proc;

ods html close;
ods package publish archive properties(archive_name="allstuff.zip" archive_path="./");
ods package close clear;
ods _all_ close;
** If you have SAS Package Reader installed ;
** you can name the file with the .SPK extension.;


[/pre]
Frequent Contributor
Posts: 78

Re: How To Attach a webpage on my email?

Hi Cynthia,

Thanks heaps for your help. It worked Smiley Happy Just if anyone need this piece of code... I got something like that :

/********** Email To ***********************/
Filename Test Email To = 'ABC@mail.com' Type='Text/html'
Subject = 'Report';
/***** Your html page starts here which will be view by the receipients *****/
ODS Markup Body = Test Style = SASWEB;
Title 'This is my title on my html';
PUT 'Hello Good Day;
ODS Markup CLOSE;
Ask a Question
Discussion stats
  • 4 replies
  • 174 views
  • 0 likes
  • 3 in conversation