SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
holcoje
Calcite | Level 5

I'm trying to send an email in SAS with an excel file attachment. As written, I get no errors but I do not receive the email at all. If I comment out the ATTACH statement, then the email does send, obviously without the attachment, I just receive the body of the email. SAS is installed on a Linux server, I'm using SAS EG on a virtual windows desktop. I have had no problems sending image attachments of charts and graphs with similar code. Can anyone see a reason why I'm not receiving my email in this case? 

 

options emailhost=smtp.test.test.test;
filename mailbox email ('test@mail.test')
     attach=("/directory/file.xlsx" content_type="application/vnd.ms-excel")
subject = "Email Subject" content_type="text/html";
ods listing close;
ods html body=mailbox;
data _null_;
     file print;
     put "This is an automated email. Please do not reply";
run;
ods html close
3 REPLIES 3
SASKiwi
PROC Star

An Excel content type of

content_type="application/xlsx"

is more usual but I'm not sure if that will fix the sending issue.

Patrick
Opal | Level 21

Is the .xlsx small enough to not exceed some limit for attachments?

tomrvincent
Rhodochrosite | Level 12
attach=
(
"foobar.xlsx" content_type="application/xlsx" lrecl=32000
)

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 8020 views
  • 0 likes
  • 4 in conversation