<?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 Re: Error when trying to send an email using SAS program in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905576#M357675</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13728"&gt;@SASJedi&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;When I tried to add the following line to the options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;emailauthprotocol&lt;/FONT&gt;=Login&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got a different error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Login failure&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Email: 504 5.7.4 Unrecognized authentication type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this indicate that my login credentials are invalid?&lt;/P&gt;</description>
    <pubDate>Fri, 01 Dec 2023 13:26:21 GMT</pubDate>
    <dc:creator>Mahis</dc:creator>
    <dc:date>2023-12-01T13:26:21Z</dc:date>
    <item>
      <title>Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905571#M357671</link>
      <description>&lt;P&gt;Hello SAS community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to send an email from a SAS program for the first time using the following method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;options&lt;/FONT&gt; &lt;FONT color="#3366FF"&gt;emailsys&lt;/FONT&gt;=smtp 
        &lt;FONT color="#3366FF"&gt;emailhost&lt;/FONT&gt;=smtphost.domainx.com 
        &lt;FONT color="#3366FF"&gt;emailport&lt;/FONT&gt;=465
        &lt;FONT color="#3366FF"&gt;EMAILID&lt;/FONT&gt;="email@domainx.com"
        &lt;FONT color="#3366FF"&gt;EMAILPW&lt;/FONT&gt;="password";

&lt;FONT color="#3366FF"&gt;filename&lt;/FONT&gt; mymail 
   &lt;FONT color="#3366FF"&gt;email&lt;/FONT&gt; "recipient@domainy.com" 
   &lt;FONT color="#3366FF"&gt;subject&lt;/FONT&gt;="Test Message";

&lt;FONT color="#333399"&gt;data&lt;/FONT&gt; _null_;
   &lt;FONT color="#3366FF"&gt;file&lt;/FONT&gt; mymail;
   &lt;FONT color="#3366FF"&gt;put&lt;/FONT&gt; 'Hello there';
&lt;FONT color="#333399"&gt;run&lt;/FONT&gt;;&lt;/PRE&gt;&lt;P&gt;But, I encountered this error:&lt;/P&gt;&lt;P&gt;"&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Email: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM&lt;/STRONG&gt;&lt;/FONT&gt;."&lt;/P&gt;&lt;P&gt;I would like to know if there is something I need to add or modify in order to resolve this issue.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 12:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905571#M357671</guid>
      <dc:creator>Mahis</dc:creator>
      <dc:date>2023-12-01T12:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905572#M357672</link>
      <description>&lt;P&gt;1)&amp;nbsp; emailauthprotocol= ?&lt;/P&gt;
&lt;P&gt;2) is&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;EMAILID&lt;/FONT&gt;="email@domainx.com"&lt;/PRE&gt;
&lt;P&gt;valid email address ?&lt;/P&gt;
&lt;P&gt;[EDIT:]&lt;/P&gt;
&lt;P&gt;3) maybe:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;emailhost&lt;/FONT&gt;=(smtphost.domainx.com SSL)&lt;/PRE&gt;
&lt;P&gt;if you have SSL there?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 12:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905572#M357672</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-12-01T12:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905574#M357674</link>
      <description>&lt;P&gt;SMTP Error 530 is an authentication issue. The most likely cause is that you provided invalid login credentials. I tried your code using my own SMTP server and credentials, and it ran without error.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 13:02:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905574#M357674</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-12-01T13:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905576#M357675</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13728"&gt;@SASJedi&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;When I tried to add the following line to the options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;emailauthprotocol&lt;/FONT&gt;=Login&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got a different error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Login failure&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Email: 504 5.7.4 Unrecognized authentication type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this indicate that my login credentials are invalid?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 13:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905576#M357675</guid>
      <dc:creator>Mahis</dc:creator>
      <dc:date>2023-12-01T13:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905577#M357676</link>
      <description>&lt;P&gt;This might depend on your email server setup and authentication. If you have single-signon or two-factor authentication (common in cloud-based email), then a simple password might not be enough to authenticate. &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-send-email-using-SAS/ta-p/746523#gmail" target="_self"&gt;See tips here&lt;/A&gt; (specific to Gmail) and see if you need to adapt accordingly.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 13:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905577#M357676</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2023-12-01T13:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905579#M357678</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Can you please let me know what information I should request from the person in charge of the SMTP server?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 13:41:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905579#M357678</guid>
      <dc:creator>Mahis</dc:creator>
      <dc:date>2023-12-01T13:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905588#M357679</link>
      <description>&lt;P&gt;Actually, in reviewing the original error I think you should try adding the FROM= option to your code. 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 simple examples.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 14:08:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905588#M357679</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2023-12-01T14:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905838#M357726</link>
      <description>&lt;P&gt;I tried the examples provided in the article, but I consistently encountered the same errors. but, when I tested sending a test email using the following command on the SAS compute server:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[sas@computeserver ~]$ swaks --to recipient@domainy.com --from email@domainx.com --server smtphost.domainx.com --tls --auth LOGIN --port 465&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the email was successfully sent. I used the same credentials that I had previously used in the SAS program. I'm unsure what might be missing in the SAS program that prevented the email from being sent.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2023 14:30:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905838#M357726</guid>
      <dc:creator>Mahis</dc:creator>
      <dc:date>2023-12-02T14:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905849#M357734</link>
      <description>&lt;P&gt;Did you fix your SAS code to specify the FROM address?&lt;/P&gt;
&lt;P&gt;Are you sure your SAS session is running on the same machine as your test?&amp;nbsp; Using the same userid?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also do any of the addresses contain special characters that might make generating them from SAS tricky?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does your SAS session have XCMD option enabled?&amp;nbsp; If so you could generate the email message first and then just call that same swaks command to send it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2023 17:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905849#M357734</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-12-02T17:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905861#M357741</link>
      <description>&lt;P&gt;&lt;FONT color="#3366FF"&gt;Did you fix your SAS code to specify the FROM address?&lt;/FONT&gt; Yes, but it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;Are you sure your SAS session is running on the same machine as your test?&lt;/FONT&gt; Yes, it is the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;Also do any of the addresses contain special characters that might make generating them from SAS tricky?&lt;/FONT&gt; Yes, the FROM address is like this: username_ab@domainx.com&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;you could generate the email message first and then just call that same swaks command to send it.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Could you please provide an example of how I can do that?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2023 18:51:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905861#M357741</guid>
      <dc:creator>Mahis</dc:creator>
      <dc:date>2023-12-02T18:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905870#M357748</link>
      <description>&lt;P&gt;Here a line from a 25 year old program:&lt;/P&gt;
&lt;PRE&gt;*----------------------------------------------------------------------;
* When not in drug project environment, send email to SPE admin.       ;
*----------------------------------------------------------------------;
  %let status = PENDING;
  %let s_msg = Project &amp;amp;drug_c waiting for SPE set up;
  x cat %gdir(gsys)scs_msg1.txt | mailx -s "SCS request &amp;amp;drug_c setup"
   -c &amp;amp;email -r cdoadm@pfizer.com &amp;amp;speadm;
&lt;/PRE&gt;
&lt;P&gt;So the message to be sent was already written to the text file scs_msg1.txt.&amp;nbsp; Then the mailx command is called to send the message as an email.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2023 23:18:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905870#M357748</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-12-02T23:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905885#M357756</link>
      <description>&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;emailauthprotocol&lt;/FONT&gt;=plain&lt;/PRE&gt;</description>
      <pubDate>Sun, 03 Dec 2023 11:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905885#M357756</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-12-03T11:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905928#M357770</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/445849"&gt;@Mahis&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please modify the following section of your code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename mymail 
   email "recipient@domainy.com" 
   subject="Test Message";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename mymail 
   to="recipient@domainy.com" 
   subject="Test Message";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It should work.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 01:41:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/905928#M357770</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2023-12-04T01:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Error when trying to send an email using SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/906928#M358071</link>
      <description>&lt;P&gt;Hello everyone, thank you all for your help. I was able to send an email using Tom's method of xcmd by adding the 'swaks' command in the script. However, I found that when I entered the password directly in the command, I got unsuccessful authentication because the password is decoded in base64 into a different password than what I typed. To avoid this issue, I used the following command to enter the password in this format:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;$(echo 'cGFzc3dvcmR4' | base64 --decode)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the full command I used to send the email:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x "swaks --to &amp;amp;rec --from &amp;amp;sen --server &amp;amp;serv --tls --auth LOGIN --port 465 --auth-user userx1 --auth-password $(echo 'cGFzc3dvcmR4' | base64 --decode) --h-Subject &amp;amp;subj --body &amp;amp;email_body --attach &amp;amp;attachment";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible that SAS also decoded my password into another password, which led to unsuccessful authentication?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 08:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-when-trying-to-send-an-email-using-SAS-program/m-p/906928#M358071</guid>
      <dc:creator>Mahis</dc:creator>
      <dc:date>2023-12-08T08:36:15Z</dc:date>
    </item>
  </channel>
</rss>

