BookmarkSubscribeRSS Feed
Lost_Gary
Quartz | Level 8

I am using SAS EG8.3 and trying to send an email via SAS for the first time at this company.  My code is as follows:


options emailsys=SMTP
emailport=25
emailid="myemail@mycompany.com";
options emailhost=
(
   "smtp.office365.com" 
port=25 STARTTLS
Auth=login
id="myID"
pw="mypw");
filename fileref email ("myemail@mycompany")
From="myemail@mycompany"
Subject="Test message"
type="text/html";
ods html body= fileref style=printer
text="Testing";
ods html close;
filename fileref clear;

The email log simply states:

ERROR: Email: The connection was refused.

I think I only just need to tweak a setting because if i switch this to emailsys=MAPI

the email will send but it prompts this message

Lost_Gary_0-1659123980870.png

Obviously I would like to email without the prompt.  Any thoughts are appreciated.  

5 REPLIES 5
SASKiwi
PROC Star

What happens if you click "Allow"?

 

Talk to your IT folks about Outlook security settings to see if there is a way to avoid this popup.

Lost_Gary
Quartz | Level 8
If I click ‘Allow’ an e-mail is sent (although it appears to be xml language and not my intended content).
SASKiwi
PROC Star

The fact that it successfully sends your email indicates that your SAS program is using the right email settings. Most likely Outlook security settings need tweaking to stop the prompt which your IT security / email experts should be able to help with. Talking to your SAS administrator would be a good idea too. 

Lost_Gary
Quartz | Level 8

what and where is that Outlook setting?   If I can tell IT what I need changed, I have a much higher chance of getting it done.  

ChrisHemedinger
Community Manager

Sending using MAPI will trigger your local Outlook client to send the message. The prompt you see is a security measure to prevent "rogue" processes from sending emails without your knowledge. (Imagine the spam bots that could exploit "quiet" automation of emails on your local PC...)

 

SMTP is the best practice for email automation. However, using Microsoft 365 and SMTP is tricky and might not be possible. See How to send email using SAS for general guidance about sending emails from SAS, including using cloud-based email.

 

These articles describe the requirements for getting SMTP working for Microsoft 365 from 3rd party apps, or alternatively using an API for the task:

 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1015 views
  • 0 likes
  • 3 in conversation