🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 01-30-2016 01:22 AM
(17179 views)
options emailsys = smtp
emailauthprotocol= login
EMAILACKWAIT=30
emailid = 'runnerupwang@outlook.com'
emailpw = 'XXXXXX'
emailhost = 'smtp.live.com'
emailport = 25 ;
filename f_email email
to = '1055103120@qq.com'
from = 'runnerupwang@outlook.com'
subject = 'Automatic Email Sending Test'
;
data _null_;
file f_email;
put 'This is a test email with an RTF attachment via SAS programming.';
run;
I'm trying to send the email in the SAS9.4 with outlook mail, but failed, and I got an error message below, it seems that I should specify SSL, but I don't know how. Thanks for your info
ERROR: Login Failed
ERROR: Email: 530 5.7.0 Must issue a STARTTLS command first
PS: This code works if I changed the sender to 163 mail, and emaihost to smtp.163.com
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I suggest you also take a look at the following
Usage Note 53215: How to set up your SAS® installation to use Secure SMTP via Gmail at:
http://support.sas.com/kb/53/215.html
More information on the options= emailhost option for SAS V9.4 can be found here:
http://support.sas.com/documentation/cdl/en/lesysoptsref/68023/HTML/default/viewer.htm#p1v9dr6zep9p9...
Here is some sample code:
options emailsys = smtp
emailid = 'runnerupwang@outlook.com'
emailpw = 'XXXXXX'
emailhost = 'smtp.live.com'
emailport = 25 ;
options emailhost=
(
"smtp.live.com"
STARTTLS auth=LOGIN
/* your Outlook address */
id=" runnerupwang@outlook.com
/* optional: encode PW with PROC PWENCODE */
pw="XXXXX" port=587
)
;
filename f_email email
to = '1055103120@qq.com'
from = 'runnerupwang@outlook.com'
subject = 'Automatic Email Sending Test';
data _null_;
file f_email;
put 'This is a test email with an RTF attachment via SAS programming.';
run;
Usage Note 53215: How to set up your SAS® installation to use Secure SMTP via Gmail at:
http://support.sas.com/kb/53/215.html
More information on the options= emailhost option for SAS V9.4 can be found here:
http://support.sas.com/documentation/cdl/en/lesysoptsref/68023/HTML/default/viewer.htm#p1v9dr6zep9p9...
Here is some sample code:
options emailsys = smtp
emailid = 'runnerupwang@outlook.com'
emailpw = 'XXXXXX'
emailhost = 'smtp.live.com'
emailport = 25 ;
options emailhost=
(
"smtp.live.com"
STARTTLS auth=LOGIN
/* your Outlook address */
id=" runnerupwang@outlook.com
/* optional: encode PW with PROC PWENCODE */
pw="XXXXX" port=587
)
;
filename f_email email
to = '1055103120@qq.com'
from = 'runnerupwang@outlook.com'
subject = 'Automatic Email Sending Test';
data _null_;
file f_email;
put 'This is a test email with an RTF attachment via SAS programming.';
run;
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This:
http://blogs.sas.com/content/sasdummy/2013/07/31/gmail-from-sas-program/
may point you in the right direction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I suggest you also take a look at the following
Usage Note 53215: How to set up your SAS® installation to use Secure SMTP via Gmail at:
http://support.sas.com/kb/53/215.html
More information on the options= emailhost option for SAS V9.4 can be found here:
http://support.sas.com/documentation/cdl/en/lesysoptsref/68023/HTML/default/viewer.htm#p1v9dr6zep9p9...
Here is some sample code:
options emailsys = smtp
emailid = 'runnerupwang@outlook.com'
emailpw = 'XXXXXX'
emailhost = 'smtp.live.com'
emailport = 25 ;
options emailhost=
(
"smtp.live.com"
STARTTLS auth=LOGIN
/* your Outlook address */
id=" runnerupwang@outlook.com
/* optional: encode PW with PROC PWENCODE */
pw="XXXXX" port=587
)
;
filename f_email email
to = '1055103120@qq.com'
from = 'runnerupwang@outlook.com'
subject = 'Automatic Email Sending Test';
data _null_;
file f_email;
put 'This is a test email with an RTF attachment via SAS programming.';
run;
Usage Note 53215: How to set up your SAS® installation to use Secure SMTP via Gmail at:
http://support.sas.com/kb/53/215.html
More information on the options= emailhost option for SAS V9.4 can be found here:
http://support.sas.com/documentation/cdl/en/lesysoptsref/68023/HTML/default/viewer.htm#p1v9dr6zep9p9...
Here is some sample code:
options emailsys = smtp
emailid = 'runnerupwang@outlook.com'
emailpw = 'XXXXXX'
emailhost = 'smtp.live.com'
emailport = 25 ;
options emailhost=
(
"smtp.live.com"
STARTTLS auth=LOGIN
/* your Outlook address */
id=" runnerupwang@outlook.com
/* optional: encode PW with PROC PWENCODE */
pw="XXXXX" port=587
)
;
filename f_email email
to = '1055103120@qq.com'
from = 'runnerupwang@outlook.com'
subject = 'Automatic Email Sending Test';
data _null_;
file f_email;
put 'This is a test email with an RTF attachment via SAS programming.';
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your support. The final solution for sending the email with Outlook Account is similar to your sample code. I have setup the emailhost option in the second part option, I wonder why I have to setup the first part system options.
/*First part Option Setup*/options emailsys = smtp
emailauthprotocol= login
EMAILACKWAIT=30
emailid = '******@outlook.com'
emailpw = 'XXXXXX'
emailhost = 'smtp-mail.outlook.com'
emailport = 25 ;
/*Second part Option Setup*/
options emailhost=
(
'smtp-mail.outlook.com' port=587
STARTTLS auth=login
id='******@outlook.com'
/* optional: encode PW with PROC PWENCODE */
pw='XXXXXX'
)
;
filename f_email email
to = ('OutMail_Address1' 'OutMail_Address2')
subject = 'Automatic Email Sending Test'
attach = 'C:\Users\Think\Desktop\test.rtf'
;
data _null_;
file f_email;
put 'This is a test email with an RTF attachment via SAS programming.';
run;
filename f_email clear;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The difference between these two is that SMTP over SSL first establishes a secure SSL/TLS connection and conducts SMTP over that connection, and SMTP with STARTTLS starts with unencrypted SMTP and then switches to SSL/TLS. This is why the email STMP system options in the SAS code are specified first, and the email host options STARTTLS are specified second.
Check this post out if you require further information:
http://stackoverflow.com/questions/17281669/using-smtp-gmail-and-starttls
Check this post out if you require further information:
http://stackoverflow.com/questions/17281669/using-smtp-gmail-and-starttls