BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
texasmfp
Lapis Lazuli | Level 10

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. 

Screenshot 2022-12-24 212204.jpg

 

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;

  

 

1 ACCEPTED SOLUTION

Accepted Solutions
texasmfp
Lapis Lazuli | Level 10

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

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

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.

Sajid01
Meteorite | Level 14

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.

texasmfp
Lapis Lazuli | Level 10

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 3483 views
  • 0 likes
  • 3 in conversation