I finally purchased and installed Outlook on my personal machine. Using SAS 9.4. I am trying to task SAS to send emails automatically. Each time, I am getting this pop-up from Outlook - which defeats the purpose.
If I choose Allow, it does send the email. I went in to the Outlook trust center and changed the Programmatic Access Settings to "Never Warn Me about suspicious activity) but that had no impact, even after rebooting.
Here is my current SAS code, but I have tried every SAS email code variation I could find within the SAS and Communities' forums with no luck. Is this a programming issue, or something I need to change in my SAS config files, a hot-fix, or something outside of SAS (SAS dll file, SAS AddIn, Outlook, registry keys, anti-virus, Windows)?
DM 'CLEAR OUTPUT'; DM 'CLEAR LOG';
options emailhost=
(
"smtp.office365.com"
/* alternate: port=487 SSL */
port=587 STARTTLS
auth=plain
/* your Gmail address */
id="xxx@xxxxxxxxxxxxxx.com"
/* optional: encode PW with PROC PWENCODE */
pw="xxxxxxxxxxxxxx"
)
;
filename myemail email
to="xxxxxxxxxxxxxx@gmail.com"
subject="Test";
data _null_;
file myemail;
put "Witty and insightful remarks";
run;
proc options group=email;
run;
Thanks Sajid01. That article has a lot of good tips. My AV software is valid, so its confusing as to why changing the Programmatic Access setting did not stop it.
I successfully used one of the suggestions, editing the Registry Keys. However, I used an abbreviated set which I found in this SAS Communities thread: https://communities.sas.com/t5/SAS-Programming/A-program-is-trying-to-send-an-email-on-your-behalf/m...
Specifically, I created the following DWORDS in the "HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\16\outlook\security" and set the hexadecimal value to 2
PromptSimpleMAPISend
PromptSimpleMAPINameResolve
PromptSimpleMAPIOpenMessage
The pop-up is off, so I don't need to approve. The messages sit in the outbox for about a minute but are sent after a slight delay. This may be the AV software scanning the emails. I'll continue testing some of the other options to see which works the best. Thanks
Googling for resources about sending mail via office365.com gets a lot less information than doing the same for gmail, which got me this.
If you can, try to use gmail as a mail backend.
Sending an email with SAS requires an SMTP server it appears you are using smtp.office365.com.
Have a look at this link https://www.msoutlook.info/question/883.
The information is a bit dated but may help. Use at your own risk.
You may as well follow what @Kurt_Bremser has suggested. In that case the the google's smtp server is used.
You can explore the possibility of using your ISP's smtp service if available.
In a corporate environment, companies have their own smtp server and SAS can be and is used to send emails.
But from a personal laptop better to use outlook/Thunderbird or other client.
Thanks Sajid01. That article has a lot of good tips. My AV software is valid, so its confusing as to why changing the Programmatic Access setting did not stop it.
I successfully used one of the suggestions, editing the Registry Keys. However, I used an abbreviated set which I found in this SAS Communities thread: https://communities.sas.com/t5/SAS-Programming/A-program-is-trying-to-send-an-email-on-your-behalf/m...
Specifically, I created the following DWORDS in the "HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\16\outlook\security" and set the hexadecimal value to 2
PromptSimpleMAPISend
PromptSimpleMAPINameResolve
PromptSimpleMAPIOpenMessage
The pop-up is off, so I don't need to approve. The messages sit in the outbox for about a minute but are sent after a slight delay. This may be the AV software scanning the emails. I'll continue testing some of the other options to see which works the best. Thanks
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.