Hi all,
Would anyone of you know whether this is possible to generate an email (to:, cc:, header, content and attachment) but without sending it directly (under windows) ?
The purpose would be to save this email in a directory so that the Business might send it after validation of the attachment.
I've checked multiple white papers on the internet but unfortunately without finding anything interesting.
Thanks upfront for the help.
Regards,
Florent
Florent,
I'm not sure that you can do that as an e-mail is not a file.
My approach has been to send the e-mail from SAS to an "intermediary" e-mail address where it is checked and forwarded it as appropriate. It adds a little garbage to the header, but accomplishes the goal.
Doc Muhlbaier
Duke
You can create an email without immediately sending it - details in the YouTube video SAS Programming Tip: Write an Email in SAS and Delay Sending You'd have to somehow automate the "Save as Draft" in Outlook, though.
Regards,
SASJedi
All,
I did accomplish the goal of my request by:
For those who are interested, I could share a sample of the SAS program that I have created.
Regards,
Florent
P.S: What is the trick to use in order to copy/paste a SAS program into a post ? Each time I do it, I loose a lot of code...
To your PS:, just click "use advanced editor" in the top right corner of the message screen.
I've tried but it still looses some lines of my code... It also breaks some lines of code into multiple lines in my post :smileyconfused:
Isn't it possible to use an html tag in order to quote the code ? I saw a lot of correctly formatted code on the old SAS discussion forum.
Thanks!
Florent wrote:
I've tried but it still looses some lines of my code... It also breaks some lines of code into multiple lines in my post
Isn't it possible to use an html tag in order to quote the code ? I saw a lot of correctly formatted code on the old SAS discussion forum.
Thanks!
The only way I have found so far is to paste the code to MS Word and then to here. It also preserves the syntax coloring. I would like a more direct way too.
proc summary data=temp nway;
class id datetime;
format datetime datetime14.;
output out=sum1;
run;
Thanks!
So, here is the sample program that I used to save an email as a .msg file:
data _null_;
currentDate= compress(put(today(), yymmdd10.), '-');
currentTime= compress(put(time(), time8.), ':');
call symput('timespan', compress(currentDate || currentTime));
run;
filename vbs "C:\WINDOWS\Temp\SaveEmail_×pan..vbs" lrecl=256;
data _NULL_;
file vbs;
put 'Set objOutlook = CreateObject("Outlook.Application")';
put 'Set objMailMessage = objOutlook.CreateItem(0)';
put 'With objMailMessage';
put '.To = "&sysuserid."';
put '.Subject = "Test Email"';
put '.Body = "Hello," & Chr(10) & Chr(10) & _';
put '"This is a test email." & Chr(10) & Chr(13) & _';
put '"The purpose of this email is to test that it was correctly saved on your desktop."';
put ".SaveAs ""C:\Documents and Settings\&Sysuserid.\Desktop\Test_Email_×pan..msg""";
put 'End With';
run;
options noxwait xsync;
X "WScript //NoLogo //B C:\WINDOWS\Temp\SaveEmail_×pan..vbs";
filename ERASEIT pipe "del ""C:\WINDOWS\Temp\SaveEmail_×pan..vbs""";
data _NULL_;
infile ERASEIT;
run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.