<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SAS Email through EG, Connection Refused in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826220#M326346</link>
    <description>&lt;P&gt;I am using SAS EG8.3 and trying to send an email via SAS for the first time at this company.&amp;nbsp; My code is as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The email log simply states:&lt;/P&gt;
&lt;P&gt;ERROR: Email: The connection was refused.&lt;/P&gt;
&lt;P&gt;I think I only just need to tweak a setting because if i switch this to &lt;CODE class=" language-sas"&gt;emailsys=MAPI&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;the email will send but it prompts this message&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lost_Gary_0-1659123980870.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73898i7645C4429192D0BF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lost_Gary_0-1659123980870.png" alt="Lost_Gary_0-1659123980870.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Obviously I would like to email without the prompt.&amp;nbsp; Any thoughts are appreciated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jul 2022 19:49:15 GMT</pubDate>
    <dc:creator>Lost_Gary</dc:creator>
    <dc:date>2022-07-29T19:49:15Z</dc:date>
    <item>
      <title>SAS Email through EG, Connection Refused</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826220#M326346</link>
      <description>&lt;P&gt;I am using SAS EG8.3 and trying to send an email via SAS for the first time at this company.&amp;nbsp; My code is as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The email log simply states:&lt;/P&gt;
&lt;P&gt;ERROR: Email: The connection was refused.&lt;/P&gt;
&lt;P&gt;I think I only just need to tweak a setting because if i switch this to &lt;CODE class=" language-sas"&gt;emailsys=MAPI&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;the email will send but it prompts this message&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lost_Gary_0-1659123980870.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73898i7645C4429192D0BF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lost_Gary_0-1659123980870.png" alt="Lost_Gary_0-1659123980870.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Obviously I would like to email without the prompt.&amp;nbsp; Any thoughts are appreciated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 19:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826220#M326346</guid>
      <dc:creator>Lost_Gary</dc:creator>
      <dc:date>2022-07-29T19:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Email through EG, Connection Refused</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826244#M326364</link>
      <description>&lt;P&gt;What happens if you click "Allow"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Talk to your IT folks about Outlook security settings to see if there is a way to avoid this popup.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 23:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826244#M326364</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-07-29T23:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Email through EG, Connection Refused</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826270#M326385</link>
      <description>If I click ‘Allow’ an e-mail is sent (although it appears to be xml language and not my intended content).</description>
      <pubDate>Sat, 30 Jul 2022 11:37:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826270#M326385</guid>
      <dc:creator>Lost_Gary</dc:creator>
      <dc:date>2022-07-30T11:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Email through EG, Connection Refused</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826291#M326394</link>
      <description>&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jul 2022 23:33:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826291#M326394</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-07-30T23:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Email through EG, Connection Refused</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826412#M326424</link>
      <description>&lt;P&gt;what and where is that Outlook setting?&amp;nbsp; &amp;nbsp;If I can tell IT what I need changed, I have a much higher chance of getting it done.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 11:40:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826412#M326424</guid>
      <dc:creator>Lost_Gary</dc:creator>
      <dc:date>2022-08-01T11:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Email through EG, Connection Refused</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826421#M326428</link>
      <description>&lt;P&gt;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...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SMTP is the best practice for email automation. However, using Microsoft 365 and SMTP is tricky and might not be possible. See&amp;nbsp;&lt;LI-MESSAGE title="How to send email using SAS" uid="746523" url="https://communities.sas.com/t5/SAS-Communities-Library/How-to-send-email-using-SAS/m-p/746523#U746523" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;for general guidance about sending emails from SAS, including using cloud-based email.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These articles describe the requirements for getting SMTP working for Microsoft 365 from 3rd party apps, or alternatively using an API for the task:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://docs.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365" target="_blank"&gt;https://docs.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://docs.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&amp;amp;tabs=http" target="_self"&gt;Send email using the Microsoft Graph API&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 12:15:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Email-through-EG-Connection-Refused/m-p/826421#M326428</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2022-08-01T12:15:19Z</dc:date>
    </item>
  </channel>
</rss>

