DATA Step, Macro, Functions and more

data step exection aborted while sending the emails from sas. How to write a exception for wrong email address

Reply
Contributor
Posts: 36

data step exection aborted while sending the emails from sas. How to write a exception for wrong email address

Please write an exception for wrong email address while sending. If the wrong email address is found its not sending the mails to the remaining users. Below is the my code.

Hi,

My mails data set looks as follows

1abc123@some.com
2def@some.com
3ghi@some.com
4jkl@some.com
5abc123@some.com
6def@some.com
7def@some.com

consider abc123@some.com is a wrong email

As of now my code looks as follows;;;

STEP=1: Sorting the data set.

--------------------------------------------------------------------------------------------------------------------

PROC SORT DATA=mails;

BY mail_id;

RUN;

-----------------------------------------------------------------------------------------------------------------------------------

STEP=2 : Sending mails for every three hundred users after holding the triggering mails process for 2 mnts..

---------------------------------------------------------------------------------------------------------------------------------------


%macro send_email;

filename hm_mail email lrecl=32000 type='text/html';


data _null_;   
set mails END=EOF;
by mail_id;
file hm_mail;


retain numofusers 0;

if first.mail_id then do; 

     numofusers=numofusers+1;
  If mod(numofusers,300) = 0 then Timer=Sleep(120,1);

  put '!EM_TO!' mail_id;
  put '!EM_SUBJECT!' 'Test Plans have been created.';
  put 'The following test plans have been created with you as a tester.';
  put '<br>';
end;

id_link = '<a href="' ||left(strip(id)) || '">' || left(strip(id)) || '</a>' ;
put '<br>';
put id_link;
put '<br>';

if last.mail_id then do;
  put '<br>';
  put 'This is a system-generated message. Do not reply to this e-mail.';
  put '!EM_SEND!';
  put '!EM_NEWMSG!';
end;

if EOF then put '!EM_ABORT!';


run;

%mend send_email;
%send_email;

Here I am getting an error message as below when %send_email is excecuted

***********Below is the error message in email logs******************************************************

WARNING: Email: 550 5.1.1 <abc123@some.com Recipient address rejected: User unknown

WARNING: Bad email address: abc123@some.com

ERROR: No email addresses specified.

FATAL: Unrecoverable I/O error detected in the execution of the DATA step program.  Aborted during the EXECUTION phase.

**************************************************************************************************************

After this its not sending emails to the remaining users..

Could you please suggest me how to add an exception to handle this error at the time of exection..

Many thanks in advance..

Valued Guide
Posts: 3,208

Re: data step exection aborted while sending the emails from sas. How to write a exception for wrong email address

Iit is your email settings and program you have not mentioned as of the used OS.

SAS(R) 9.4 Companion for Windows, Third Edition   You did not even mention what is working just something that doesn't.

With that little information how could we help.  The only answer we can give: "some people are using email. What it the difference with yours"   

---->-- ja karman --<-----
Contributor
Posts: 36

Re: data step exection aborted while sending the emails from sas. How to write a exception for wrong email address


We are using WINDOWS 7 Enterprise

System Type : 64- bit Operating System

Valued Guide
Posts: 3,208

Re: data step exection aborted while sending the emails from sas. How to write a exception for wrong email address

Still not complete: 
- SAS Server or client not really relevant with Windows but:

   --> What SAS Version?

- As you are trying to send mail.

  --> what is your email provider.  Searching for the mailserver provider.

  the client usage (ourlook) could be an indicator for exchangen.

  --> do you have service-contact  with your email-provider.  

Did a single mail-send work and how did that work?

---->-- ja karman --<-----
Contributor
Posts: 36

Re: data step exection aborted while sending the emails from sas. How to write a exception for wrong email address

--> What SAS Version?

Operating System:   SUN X64 ;

--> what is your email provider.

My email provider is confidentil.

--> do you have service-contact  with your email-provider.

I dont have service contact with my email provider

-->Did a single mail-send work and how did that work?

Yes it is working. I am able to send the mail. My problem is, if it is trying to trigger to a invalid email id its stopping there itself and its not sending mails after the wrong email id which is encountered. So kinldy look at my code and help out with an exception,even though it is encountering the wrong email, it should send the mails to others after the wrong email addres.

NOTE : I cant validate the email addresses before sending the emails.

Valued Guide
Posts: 3,208

Re: data step exection aborted while sending the emails from sas. How to write a exception for wrong email address

Version:   SUNX64 is a server based Unix not Windows. 

     SAS could be 8.2 9.1. 9.2 9.3 9.4 or Eguide 4.1 4.3 5.1 6.1 or SMC  ....  Ask your Chief version officer for the correct SAS version.

     You can see yourself lot with: %put _all_ ; proc setinit; run; proc options ;run;   When you know at what things to look at.

Emailprovider confidential?  humbug I am not akser user/pwd but for the technical conenctions.

   It can be local (only Eguide and Base Windows) or server based.

   With Server-bases emal you could use Gmail   Outlook.com or whatever but all settings for that are needed to be set and validated.

   As spammers are normally blocked bye firewalls limits or whatever on the server-side  that should be an attention point.

Local mail by base/Eguide is often working being connected tot the local mail-client on your desktop. That one is not intended for bulkmail and is also having often restrictions to block spammers.

As you are having problems of this kind..... Are you a spammer?

---->-- ja karman --<-----
Contributor
Posts: 36

Re: data step exection aborted while sending the emails from sas. How to write a exception for wrong email address

:smileycool:
--We are using sas enterprise guide 4.3.0.10196

--Email is, server based and all the settings has been done and validated

--I am not a spammer.

Valued Guide
Posts: 3,208

Re: data step exection aborted while sending the emails from sas. How to write a exception for wrong email address

Eguide 4.3 you must be using SAS 9.2.

Email is server based, nice than there is a guy maintaining that mail-server, who?

That who you do not to answer just go to that guy.

SAS is opening a connection to that mailserver and giving that all the mail. What is obviously happening every mail-address is checked by that service and when not existent the connection is dropped may be blocked for some time.

This is a list how SMTP servers may react. SMTP error messages and reply codes | smtp mail server it are settings on that side that could be changed. There can be a lot configured on that side http://exchangeserverpro.com/exchange-2013-mail-flow/

---->-- ja karman --<-----
Contributor
Posts: 36

Re: data step exection aborted while sending the emails from sas. How to write a exception for wrong email address

Thanks for you guidence.

Previously we were facing an issue like, if the email load is high while sending from the sas,it was giving the warning message like the message has not been sent. But we didnt approaced the  mail-server admin to reolve the issue by increasing the server respond time. What we did was, by using CALL SLEEP we  over came.

I think you havent seen my code properly. I clearly explained about the issue and why the exception I want.

NOTE :- From server side every thing is perfect and am able to send mails only if all are correct mails. But in the middle if it found any incorrect email its aborting the process and its not sending the mails to remaining.

Valued Guide
Posts: 3,208

Re: data step exection aborted while sending the emails from sas. How to write a exception for wrong email address

Prasad I did include the SMTP error messages you can see the mail-server admin has the options to block you on all kind of things. Limited time number of mails invalid mail, as you are not the master (server) of the mailproces but just a client you can have correct code at the sas client and that is correct disabled by the mailserver.   You are not happy with that but the whole chain should be functionally working dependent on the weakest link.

Yes I have seen your previous post with that time-out. I was wondering why you did not go for the chain analyses but trying to do a circumvention, the root-cause still snagging.  

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 9 replies
  • 477 views
  • 0 likes
  • 2 in conversation