<?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: sending emails from sas in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150050#M11775</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A __default_attr="828210" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Dec 2014 12:39:43 GMT</pubDate>
    <dc:creator>K_HARI__PRASAD</dc:creator>
    <dc:date>2014-12-26T12:39:43Z</dc:date>
    <item>
      <title>sending emails from sas</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150045#M11770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My mails data set looks as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="101" style="border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;&lt;A class="jive-link-email-small" href="mailto:abc123@some.com"&gt;abc123@some.com&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;&lt;A class="jive-link-email-small" href="mailto:def@some.com"&gt;def@some.com&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;&lt;A class="jive-link-email-small" href="mailto:ghi@some.com"&gt;ghi@some.com&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;&lt;A class="jive-link-email-small" href="mailto:jkl@some.com"&gt;jkl@some.com&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;&lt;A class="jive-link-email-small" href="mailto:abc123@some.com"&gt;abc123@some.com&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;&lt;A class="jive-link-email-small" href="mailto:def@some.com"&gt;def@some.com&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;7&lt;/TD&gt;&lt;TD style="padding: 2px; border: 1px solid #000000;"&gt;&lt;A class="jive-link-email-small" href="mailto:def@some.com"&gt;def@some.com&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;consider &lt;A href="mailto:abc123@some.com"&gt;abc123@some.com&lt;/A&gt; is a wrong email&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As of now my code looks as follows;;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;STEP=1: Sorting the data set.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;PROC SORT DATA=mails;&lt;/P&gt;&lt;P&gt;BY mail_id;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;STEP=2 : Sending mails for every three hundred users after holding the triggering mails process for 2 mnts..&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro send_email;&lt;/P&gt;&lt;P&gt;filename hm_mail email lrecl=32000 type='text/html';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data _null_;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt; set mails END=EOF;&lt;BR /&gt; by mail_id;&lt;BR /&gt; file hm_mail;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; retain numofusers 0;&lt;/P&gt;&lt;P&gt;if first.mail_id then do;&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numofusers=numofusers+1;&lt;BR /&gt;&amp;nbsp; If mod(numofusers,300) = 0 then Timer=Sleep(120,1);&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; put '!EM_TO!' mail_id;&lt;BR /&gt;&amp;nbsp; put '!EM_SUBJECT!' 'Test Plans have been created.';&lt;BR /&gt;&amp;nbsp; put 'The following test plans have been created with you as a tester.';&lt;BR /&gt;&amp;nbsp; put '&amp;lt;br&amp;gt;';&lt;BR /&gt; end;&lt;/P&gt;&lt;P&gt;id_link = '&amp;lt;a href="' ||left(strip(id)) || '"&amp;gt;' || left(strip(id)) || '&amp;lt;/a&amp;gt;' ;&lt;BR /&gt; put '&amp;lt;br&amp;gt;';&lt;BR /&gt; put id_link;&lt;BR /&gt; put '&amp;lt;br&amp;gt;';&lt;/P&gt;&lt;P&gt;if last.mail_id then do;&lt;BR /&gt;&amp;nbsp; put '&amp;lt;br&amp;gt;';&lt;BR /&gt;&amp;nbsp; put 'This is a system-generated message. Do not reply to this e-mail.';&lt;BR /&gt;&amp;nbsp; put '!EM_SEND!';&lt;BR /&gt;&amp;nbsp; put '!EM_NEWMSG!';&lt;BR /&gt; end;&lt;/P&gt;&lt;P&gt;if EOF then put '!EM_ABORT!';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%mend send_email;&lt;BR /&gt;%send_email;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I am getting an error message as below when %send_email is excecuted&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********Below is the error message in email logs******************************************************&lt;/P&gt;&lt;P&gt;WARNING: Email: 550 5.1.1 &amp;lt;&lt;A href="mailto:abc123@some.com"&gt;abc123@some.com&lt;/A&gt; Recipient address rejected: User unknown&lt;/P&gt;&lt;P&gt;WARNING: Bad email address: &lt;A href="mailto:abc123@some.com"&gt;abc123@some.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;ERROR: No email addresses specified.&lt;/P&gt;&lt;P&gt;FATAL: Unrecoverable I/O error detected in the execution of the DATA step program.&amp;nbsp; Aborted during the EXECUTION phase.&lt;/P&gt;&lt;P&gt;**************************************************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this its not sending emails to the remaining users..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please suggest me how to add an exception to handle this error at the time of exection..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks in advance..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2014 06:43:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150045#M11770</guid>
      <dc:creator>K_HARI__PRASAD</dc:creator>
      <dc:date>2014-12-15T06:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: sending emails from sas</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150046#M11771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unless you want to split the process so that every mail address is handled in a single data step, you will have to weed out the invalid mail ID's. The I/O error caused by the faulty email address stops the data step for good.&lt;/P&gt;&lt;P&gt;With separate data steps, you could reset &lt;EM&gt;%let syscc=0;&lt;/EM&gt; and &lt;EM&gt;options obs=max;&lt;/EM&gt; in between.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2014 07:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150046#M11771</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-12-15T07:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: sending emails from sas</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150047#M11772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;We are unable to find the invalid email ids before sending the emails. While execution time only we are coming to know that the mail id is incorrect and it is causing to terminate the data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you replied, Could you please write the code by including&lt;/P&gt;&lt;P&gt;&lt;EM&gt;%let syscc=0;&lt;/EM&gt; and &lt;EM&gt;options obs=max;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2014 12:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150047#M11772</guid>
      <dc:creator>K_HARI__PRASAD</dc:creator>
      <dc:date>2014-12-15T12:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: sending emails from sas</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150048#M11773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Modify your macro so that it sends a single mail:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro send_email(recipient);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set mails (where=(mail_id="&amp;amp;recipient")) end=EOF;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(use if _n_ = 1 instead of if first.mail_id)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%let syscc=0;&lt;/P&gt;&lt;P&gt;options obs=max;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then do;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=mails (keep=mail_id) out=mails_help nodupkey;&lt;/P&gt;&lt;P&gt;by mail_id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set mails_help;&lt;/P&gt;&lt;P&gt;comstr = '%send_email('!!trim(mail_id)!!');';&lt;/P&gt;&lt;P&gt;call execute(comstr);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(untested, so you may have to do some corrections)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The %let syscc=0; and options obs=max; reset any condition caused by a data step error, may be unnecessary.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2014 13:43:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150048#M11773</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-12-15T13:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: sending emails from sas</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150049#M11774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think it is the Bad or unknown email address that is causing your program to terminate the data step - these are only Warnings.&amp;nbsp; The real problem is indicated by "ERROR: No email addresses specified" - i.e. the email process thinks it doesn't have an email address to process, not just a bad email address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this may be caused by:&lt;/P&gt;&lt;P&gt;if last.mail_id then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp; put '!EM_NEWMSG!';&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt;which I think would initiate an email message without an EM_TO when the final row in the mails dataset is reached. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've often had Bad or unknown email addresses, and they've never caused my SAS programs to crash.&amp;nbsp; But, in my case, the email process has always been asynchronous - usually through SMTP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Dec 2014 04:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150049#M11774</guid>
      <dc:creator>DaveBirch</dc:creator>
      <dc:date>2014-12-16T04:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: sending emails from sas</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150050#M11775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A __default_attr="828210" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Dec 2014 12:39:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/sending-emails-from-sas/m-p/150050#M11775</guid>
      <dc:creator>K_HARI__PRASAD</dc:creator>
      <dc:date>2014-12-26T12:39:43Z</dc:date>
    </item>
  </channel>
</rss>

