11-13-2014 05:25 AM
I have to send emails from SAS by fetching the data from a data set. I have the mail ids around 5000. Hence I am getting "WARNING: Email service not available". Hence I would like to send the first 200 mails first and hold the process for few seconds and start the process to send 201 to 400 and hold the process for the same few seconds and so on.
My data set looks as follows.
All these are unique mail ids.
I am new to SAS and I wrote the code as below..but I am getting "WARNING: Email service not available" becuase of SMTP server timeout or heavy load.
FILENAME file_mail EMAIL LRECL=3200 TYPE='text/html';
SET emails END=EOF;
BY mailid userid;
put '!EM_TO!' mailid;
put '!EM_SUBJECT!' 'Test Plans have been created.';
put 'The following test plans have been created with you as a tester.';
link = '<a href="' ||left(strip(userid)) || '">' ||'</a>'
if EOF then
11-13-2014 07:21 AM
You could do this in the data step:
retain counter 0;
counter + 1;
if counter = 200 then do;
counter = 0;
11-13-2014 07:40 AM
Of course, but calling the mod() function with every iteration may unnecessarily eat CPU cycles. Blame it on the old-school programmer in me
11-14-2014 01:04 AM
Thanks for your reply.
Its throwing an error after including the above either of the above two codes in DATA STEO, like
"ERROR: Undeclared array referenced: sleep."
Could you please write the entire code.
Many thanks in advance.
11-14-2014 02:38 AM
my bad; did some C lately, where one calls a function like a procedure.
11-14-2014 03:33 AM
Then it is not a load problem, you most probably are not allowed to send >= 500 emails in one action.
So I'd suggest to split the data set into chunks < 500 and iterate through these with a macro.
11-14-2014 05:15 AM
Yes, you need to write the macro in a way to be flexible, so it does do your work for you in the future.
11-14-2014 03:27 AM
That number of 499 is weird a human setting to be expected at the server side. Is it possible?
- Exchange Online Protection Limits | Exchange Online Protection Service Description (number of outbound message send)
The error message should probably not some unexplainable error but one telling a limit like this has been reached
Can you validate this?
Need further help from the community? Please ask a new question.