I'm trying to have a SAS program send an e-mail. We have SAS 9.3 running on Windows 7 professional but are still using Outlook 2007. Has anyone done this successfully with a similar setup?
Thanks
Have you had a chance to review previous postings regarding sending emails from SAS?
Robby,
Thanks for the direction. I looked at the threads you mentioned. In the first one, she says she put in the ip address of her mail system in the emailhost parameter but when I do that it only looks at the first 7 characters and treats the rest as an 'unrecognized option'
Other than that,not getting anywhere.
Hi,
It might be worth posting your code with the error message showing, then it might help someone identify the issue.
One question is have you ever managed to send email via SAS with a different set up?
Regards,
Amir.
I have tried it with emailsys SMTP with the following result:
5980 %let hst = EXCHANGE;
5981
5982 options emailsys=SMTP;
5983 options emaildlg=NATIVE;
5984 options emailport=25;
5985 options emailauthprotocol=NONE;
5986 options emailhost=&hst;
5987 options NOEMAILFROM;
5988 options emailid="nkaufman@pch.com";
5989 options emailpw=XXXXXXXX;
5990
5991
5992 filename outbox email "nkaufman@pch.com" debug;
5993
5994 data _null_;
5995 file outbox
5996 to=("nedkaufman@gmail.com")
5997 /* Overrides value in filename statement */
5998 cc=("nedkaufman@gmail.com")
5999 subject="My SAS Output"
6000 /* attach=("C:\sas\results.out" "C:\sas\code.sas")*/
6001 ;
6002 put 'Folks,';
6003 put 'program ran';
6004 put 'It worked great!';
6005 run;
NOTE: The file OUTBOX is:
E-Mail Access Device
S: HELO NKAUFMAN.classic.pchad.com
ERROR: Email: The software caused the connection to abort.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 2.16 seconds
cpu time 0.03 seconds
and with emailsys MAPI
as follows:
6006 %let hst = EXCHANGE;
6007
6008 options emailsys=MAPI;
6009 options emaildlg=NATIVE;
6010 options emailport=25;
6011 options emailauthprotocol=NONE;
6012 options emailhost=&hst;
6013 options NOEMAILFROM;
6014 options emailid="nkaufman@pch.com";
6015 options emailpw=XXXXXXXX;
6016
6017
6018 filename outbox email "nkaufman@pch.com" debug;
6019
6020 data _null_;
6021 file outbox
6022 to=("nedkaufman@gmail.com")
6023 /* Overrides value in filename statement */
6024 cc=("nedkaufman@gmail.com")
6025 subject="My SAS Output"
6026 /* attach=("C:\sas\results.out" "C:\sas\code.sas")*/
6027 ;
6028 put 'Folks,';
6029 put 'program ran';
6030 put 'It worked great!';
6031 run;
ERROR: Undetermined I/O failure.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
Thanks again!
Before you define too many of the email options run...
proc options group=email;
run;
...and check what's already defined for you.
In your code you call your email server just "EXCHANGE".
%let hst = EXCHANGE;
options emailhost=&hst;
Shouldn't this be a fully qualified name like exchangexx.xxx.xxx.xxx (how is it called in the account settings of your Outlook client?).
"ERROR: Email: The software caused the connection to abort"
You get this error if some of your email settings are wrong (wrong server name, wrong port,...). port 25 is only the standard port. It can be different at your site.
In your code I see that you try to connect to GMAIL using the EMAILSYS=SMTP option. That does not work. GMAIL uses a secure link to connect to the mail server and that is not supported in the current release of the SMTP option. So you must use EMAILSYS=MAPI.
However it is important that the EMAILID is exactly (case sensitive) as it is defined in the mail client that handles the MAPI calls. In GMAIL the EMAILID is normally the mail address, without the domain information. E.g. I used the email address erik.t.sasgf2012@gmail.com for communications regarding SAS Global Forum 2012 and the login code for GMAIL was erik.t.sasgf2012. So that should be the value in the EMAILID option.
Something similar applies when trying to send mails via Hotmail.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.