BookmarkSubscribeRSS Feed
apeksha
Fluorite | Level 6

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 

3 REPLIES 3
ballardw
Super User

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.

apeksha
Fluorite | Level 6

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

apeksha
Fluorite | Level 6

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;*/

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
  • 3 replies
  • 2006 views
  • 0 likes
  • 2 in conversation