BookmarkSubscribeRSS Feed
Calcite | Level 5

I am trying to send an email using emailsys=MAPI with a SAS dataset attachment. Problem is that the SAS dataset needs to be encrypted, therefore, SAS is unable to access the dataset to attach. The SAS dataset was encrypted via SAS using encrypt=AES. I am using SAS 9.4 located on my computer.


I am pretty sure the error is originating due to the encrypted dataset, since i tried attaching a non-encrypted SAS dataset and sending and was able to successfully do it without any issues.


Does anybody know if it is possible to send an email through SAS with an encrypted sas document attached? If so, could you please share code. Currently, this is the code I have and it works as long as the SAS dataset is not encrypted.


options emailsys=MAPI emailhost=XXXXXXX.Enterprise.XXX.ds.XX.XX emailport=25;

filename outmail email ""


 subject = "USAPHC Data is Ready";


data _null_;

file outmail;

put 'Hello,';

put ;

put 'The SAS dataset you require is attached. Please let me know if you need anything further.';


put 'Thank you.';





Alternatively, I thought I could just sent an encrypted email and not encrypt the SAS dataset, but from what I read, SAS does not have the capability to encrypt an email.


Thank you.



Diamond | Level 26 RW9
Diamond | Level 26

Why are you emailing something if it is sensitive enough to need encrypting?  Use the right tools for the job!   If its sensitive then use a secure web portal or a secure ftp transfer.  Email is a dreadful means of data transfer in the best of circumstances, and really shouldn't be used for the transmital of data, especially sensitive data.  Next you will be telling me that you use zip + password in separate email, hilarious to think a hacker who can intercept 1 mail cant intercept the next.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 2 in conversation