BookmarkSubscribeRSS Feed
radha009
Quartz | Level 8

How to from sas i can send email the generated report to recipient with report content in the body section.

5 REPLIES 5
radha009
Quartz | Level 8

i got it to send the text in the body section. But email is sending fine. but the text looks as below

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta name="Generator" content="SAS Software Version 9.4, see www.sas.com"> <meta http-equiv="Content-type" content="text/html; charset=windows-1252"> <title>SAS Output</title> <style type="text/css">

<!--

.aftercaption

{

  background-color: #E0E0E0;

  border-spacing: 0px;

  color: #000000;

  font-family: Arial, Helvetica, sans-serif;

  font-size: medium;

  font-style: normal;

  font-weight: bold;

  padding-top: 4pt;

}

.batch

SuryaKiran
Meteorite | Level 14

try CT in Filename

CT= "text/html" 

 

Thanks,
Suryakiran
DaveHorne
SAS Employee

Try the ODS MSOffice2K destination and see if that gives you better results:

 

 

filename mailbox email subject="Test Class Inventory"
       from="Info@YourDomain.com"
     sender="Info@YourDomain.com"
         to=("Dave@YourDomain.com")
       type="text/html";

ods listing close;
ods MSOffice2K body=mailbox style=HTMLblue;

TITLE1 "Test Class Inventory";
FOOTNOTE1 "Generated by the SAS System on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";
proc print data=sashelp.class;
run;

ods _all_ close;
ods listing;

 

SuryaKiran
Meteorite | Level 14

Check this code that I use to send a report with text in the email. Report will be in the body. I'm using a custom style since to make my email look good.

Proc template;
Define style Style.Custom;
parent=styles.Default;
style html
   "Common HTML text used in the default style" /
   'expandAll' = "<SPAN onClick=""if(msie4==1)expandAll()"">"
   'posthtml flyover line' = "</SPAN><HR size=3>"
   'prehtml flyover line' = "<SPAN><HR size=3>"
   'prehtml flyover bullet' = %nrstr("<SPAN><b>·</b>")
   'posthtml flyover' = "</SPAN>"
   'prehtml flyover' = "<SPAN>"
   'break' = "<br>"
   'Line' = "<HR size=3>"
   'PageBreakLine' ="";
end;
run;
FILENAME output EMAIL
	SUBJECT= "Test email"
	FROM="abc@abc.com" 
	TO=("123@abc.com")
 	CT= "text/html" /* Required for HTML output */ ;

ODS HTML File=output rs=none STYLE=Style.Custom ;

proc odstext;
   p "Hi, ";
   p "  ";
   p "  ";
   p "Add your text here";
   p "  ";
run;

proc print data=sashelp.class;
run;
proc odstext;
   p "  ";
   p "  ";
   p "  ";
   p "Thanks, ";
   p " Kiran  ";
   p "  ";
run;
ODS _ALL_ CLOSE;
Filename output clear;
Thanks,
Suryakiran
radha009
Quartz | Level 8

i used same proc template and tried stil getting the same <DocType...> format

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 5 replies
  • 7849 views
  • 1 like
  • 3 in conversation