BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JayS
Obsidian | Level 7

EG: 7.15

EG Program creates an Excel file on UNIX SAS Grid.

When attached to a EG Generated email the attachment (email generation is fine) is corrupt and can not be opened.

User gets the 1st warning message then the 2nd MS noted file corrupt message.

When moved (FTP) to local desktop the Excel file opens fine.

Any thoughts... TIA

 

Here is the EG SAS Code...

 

/* Setting up email routine to email the Excel to the users */
/******************************************************************/
FILENAME mymail EMAIL
Attach = '/xx/xx/Metric_ReWrite/Acctname_Metric_MatchStatus.xlsx';
RUN;

 

DATA _null_;
FILE mymail;
PUT "!EM_TO! (&NOTIFY.)";
PUT "!EM_CC! (&NOTIFYCC.)";
PUT "!EM_REPLYTO! (&REPLYTO.)";
PUT "!EM_SUBJECT! Testing Email Of Client Master List VS Master_New (File From UNIX SAS GRID)";
PUT " ";
PUT " *** Testing to see if the Excel is still corrupt *** ";
PUT " ";
PUT "** Confirm Attachment: Acctname_Metric_MatchStatus.xlsx";
PUT " ";
PUT " ";
PUT "<EOF> End Of Testing <EOF>";
PUT " ";
RUN;

1 ACCEPTED SOLUTION

Accepted Solutions
JayS
Obsidian | Level 7

After digging around this nice simple code worked...

Thanks, Jay

 

filename outbox email
      from='abc@abc.com'
	  to='abc@abc.com' 
	  type='text/html'
	  subject='Test Mail'
	  attach=("/user/test.xlsx" content_type="excel");
	  
ods html body=outbox rs=none style=Htmlblue;

proc odstext;
p 'Hello,';
p ' Please find the attachment';
p 'Thank You';
title;
run;
ods html close;

View solution in original post

4 REPLIES 4
JayS
Obsidian | Level 7

Added the code, seems to include another file as an attachment, that is not an excel file.
It's odd as the new file has part of the email message in the file.

I have to open in Notepad to read it...

Still digging, thanks.

Jay

JayS
Obsidian | Level 7

After digging around this nice simple code worked...

Thanks, Jay

 

filename outbox email
      from='abc@abc.com'
	  to='abc@abc.com' 
	  type='text/html'
	  subject='Test Mail'
	  attach=("/user/test.xlsx" content_type="excel");
	  
ods html body=outbox rs=none style=Htmlblue;

proc odstext;
p 'Hello,';
p ' Please find the attachment';
p 'Thank You';
title;
run;
ods html close;
Tom
Super User Tom
Super User

Why are you sending an HTML file but pretending it is an XLSX file?

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