BookmarkSubscribeRSS Feed
tbellmer_wf
Fluorite | Level 6

I can easily generate HTML based emails with logos and attachments.  Yesterday I was requested to capture a copy of selected emails (for audit purposes) and one suggestion was to get a new email account to log and save the emails to a folder.  Sounds good but not sure if or how long it might take to get a new email account and to then be able to redirect the email to a folder and give it an unique name. 

 

While I know I can use multiple filenames to write out content, I am afraid the use of all those email statements that start with EM_ are too specific to make this work as expected.  I mean think about how to store say an Excel file if it is not using the email engine.

7 REPLIES 7
Reeza
Super User

It may vary a bit on the code but could you just wrap the code in ODS EXCEL?

SASKiwi
PROC Star

You would be way better off creating a dedicated email account to store copies of the emails sent. That way you can be sure that it only contains that were actually sent. If you try doing it all from SAS then it's quite possible that it could create emails that were never sent. Also you are avoiding a lot extra coding.

Reeza
Super User
Except getting data back out of Exchange/email is a PITA. Currently working to try and get emails out of a email inbox to process and it's painful.


Ultimately decide what is important here.
Maybe instead of the actual email, you log it? So create a table that adds that a report was run, the log and the XLSX file location.

SASKiwi
PROC Star

@Reeza - I was thinking more along the lines that an email account "Sent" folder is the most accurate record of what emails were sent so this would be good for audit purposes. Writing out individual emails is as easy as opening them and doing a "File Save As" (not something you would manually do for all emails obviously) but I guess it all depends on the use case details of the OP.

Quentin
Super User

In the SAS program that sends the email, you could BCC the email account for archiving emails.  And then I would let that account manage the process of filing the emails into a folder through Outlook automation or VBA or whatever.

 

I generally BCC myself on automated emails I send from SAS jobs, then have an outlook rule that files them based on the subject or sender or whatever.

 

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
tbellmer_wf
Fluorite | Level 6

Thanks Quentin, I like the idea overall.  Our SAS server is on Linux - is there a way to maybe create a new email account for this purpose and instead of using MS Outlook, have the emails go to some Outlook equivalent email on the Linux box?  I do not think I can set an Outlook rule that will route the email back to the Linux box but then again, I have not tried it either.

 

Point is, I guess there is no way to have another FILENAME / FILE combo to write out the generated email within SAS.  I know this is an odd request but I can see the value in storing selecting emails to ensure everyone got it and to historically reference them for audit purposes.  This is a new requirement and I of course would like to automate the entire task...

SASKiwi
PROC Star

Talk to your IT email experts. In my experience they are very helpful when creating non-personal email accounts for specific business purposes. One common use is to advise SAS users when scheduled jobs have failed.

 

Why do you need the emails stored on your SAS server? As long as they are accessible by users they can be stored anywhere and its a lot easier to use your existing email systems than to set up a new one.

 

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