hi,
i am trying to send a mail via SAS which should include:-
1) An attachment which is an excel
2) A graph in the body of email.
When i am trying to attach the file i get this error:-
there is no documentation for this error anywhere, does anyone know why it happens? is this realted to access? how can i fix it?
The graph in the body of the email contains only a cross in the box. The graph appears perfect in my output when i run the code,, but it doesnt appear in the email body.
here is my code:-
FILENAME myemail2 EMAIL
SUBJECT= "XXX count"
FROM= "wavealerts@XXX.co.in"
attach= "\\10.10.2.51\XXX\SAS Automation\report.xlsx"
TO= ("apeksha@XXX.com")
CT= "text/html" /* Required for HTML myemail2 */ ;
ods listing close;
ods graphics on;
/*options device=png;*/
ODS HTML BODY=myemail2;
goptions ftext='Arial' htext=2 gunit=pct ctext=green;
goptions reset=all device=png;
/*hsize=24cm vsize=12cm; */
symbol1 v=dot i=join c=red h=.5 POINTLABEL=(HEIGHT = 7PT '#perc_viewing_hh');
symbol2 v=dot i=join c=blue h=.5 POINTLABEL=(HEIGHT = 7PT '#Average_Viewers');
axis1 label=(angle=90 rotate=0 "Viewing HH %");
axis11 label=(angle=90 rotate=0 "Average Viewership") ;
axis2 offset=(0,0);
title h=2 font='Calibri/bo' "Weekly - Avg Viewership and Viewing HH % V/S Year-Weeks";
proc gplot data=test.weekly;
plot Average_Viewers*year=2/vaxis=axis11 haxis=axis2 caxis=blue legend;
plot2 perc_viewing_hh*year=1/vaxis=axis1 haxis=axis2 caxis=blue legend;
run;
ODS HTML CLOSE;
ods graphics off;
i also tried the following code:-
http://robslink.com/SAS/democd67/mail_a_graph.sas but i get lrecl too small error. I have tried fixinf it with mentioning content type and lrecl in the attachment but it doesnt seem to help.
has anyone faced similar issues? please let me know if there is a work around.
Thanks,
Apeksha Pathak
If you posted the error message then it doesn't seem to be appearing in the forum.
It is more helpful to post the code from the log along with the error as the location and sometimes an _ is placed at the location in the code the SAS found the error.
Hi,
This is the exact error for the sending attachment.
NOTE: Writing EXCEL file: \\10.10.2.51\XXX\SAS Automation\Report.xlsx
177
178 FILENAME myemail2 EMAIL
179 SUBJECT= "Audxml count"
180 FROM= "wavealerts@barcindia.co.in"
181 attach= "\\10.10.2.51\XXX\SAS Automation\Report.xlsx"
182 TO= ("apeksha@XXX.com")
183 CT= "text/html" /* Required for HTML myemail2 */ ;
184 /*ods listing close;*/
185 /*ods graphics on;*/
186 /*options device=png;*/
187 ODS HTML BODY=myemail2;
NOTE: Writing HTML Body file: MYEMAIL2
188 ODS HTML CLOSE;
ERROR: Encryption Error: Invalid parameter.
189 ods graphics off;
Thanks,
Apeksha Pathak
Hi,
i have managed to get rid of the error, but the file attachment is NOT being sent.
175 ods graphics off;
176 ods excel close;
NOTE: Writing EXCEL file: \\10.10.2.51\XXX\SAS Automation\Report.xls
177
178 ods html close;
179 FILENAME myemail2 EMAIL
180 TO= ("apeksha@XXX.com")
181 FROM= "wavealerts@XXX.co.in"
182 SUBJECT= "Audxml count"
183 CT= "text/html" /* Required for HTML myemail2 */
184 attach= ("\\10.10.2.51\XXX\SAS Automation\Report..xls" content_type="application/vmd.ms-excel");
185 ods listing close;
186 /*ods graphics on;*/
187 /*options device=png;*/
188 ODS HTML FILE=myemail2;
NOTE: Writing HTML Body file: MYEMAIL2
189 /*ODS HTML CLOSE;*/
190 /*ods graphics off;*/
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.