02-16-2012 11:25 AM
Need some help to resolve the issue with the length of email ID list.
I use a datastep to mail my customers. Unfortunately, the list is huge. I use a bit of list in the !EM_TO! and most of the mail ID list in the !EM_CC!. Here, the issue is that !EM_CC! is truncated to some default length and so couldnt deliver mail to the rest of the list.
I tried using LRECL= option(in the FILENAME statement) to increase the record length, which didnt work for me. I doubt if this option is specific to the external files only.
Any ideas to resolve or alternative suggestions would be highly appreciated.
02-16-2012 05:30 PM
Try creating a Distrubution List with all the email ID's. Usually bigger organizations have the capabilty to create DG list for emails. Paste the DG name in the code and it should work.
02-18-2012 03:04 AM
Thanks Hima, This is what we are trying as of now. But I'm looking for a permanent solution, where we can increase the length of the string to accept all email IDs.. let me know if U've any ideas..
As we've around 100 jobs to run... itz very difficult for us to create so many DGs.. Hope U can understand..
02-18-2012 10:48 AM
Can you give an estimate of the limit that you are hitting?
How many addresses are you talking about? What is the total length of the addresses?
Does it work any differently when you use code generation to put the list into the CC= option instead of generating it with !EM directives?
02-18-2012 07:32 PM
Anyone know what the limitations are for the Address, CC and the various EM_ fields? Interestingly, the documentation doesn't appear to mention anything about limitations.
02-18-2012 11:04 PM
Sorry Tom, my addresses are not fixed... these will vary from report to report... I can say that, as I found, mails are not being generated for those IDs that are in the list after 256 characters... my list went on to 600 to 1080 characters for diff requirements..
I used a macro variable to put the list into the cc=, nothing more.. any help?!!
02-19-2012 12:31 AM
You could always read your emails, one by one, in a loop that executes your code inserting each address and sending the email before getting the next one.
02-19-2012 11:45 AM
Runs some experiments to test the limits.
You do not have to place the code all on one line of the program.
For example you could create a file name with more that 300 email addresses using your text editor and try using it to send a test message.
filename testmail email 'me@myhost' cc=
That format is easy to generate with a data step from your database of addresses.
filename code temp;
set cclist end=eof;
if _n_=1 then put 'filename testmail email ' email $quote. 'cc=' ;
else put ' ' email $quote. ;
if eof then put ');';
You might also try sending an email with your normal email tool and see if the limit is in your mail server instead.
02-21-2012 07:54 PM
Here is an idea, I hope it helps.
In this example I will import an excel file that has the email addresses to tblEmail and then email all the addresses in tblEmail I will assume that the column name for the email address is Email. I dont have SAS at home so I cant test this.
/* if you have a table with the email addresses then you dont need this */
OUT = WORK.IMPORT /* CREATE THE TABLE TO IMPORT THE DATA INTO */
DATAFILE = "C:\DATA.XLS" /* EXCEL FILE TO IMPORT */
REPLACE; /* REPLACE THE TABLE IF IT IS ALREADY THERE /*
SHEET = "SHEET1"; /* THE NAME OF THE SHEET TO IMPORT */
GETNAMES=YES; /* COLUMN HEADERS */
/* let send out the email to everyone */
FILENAME OUTBOX EMAIL;
SET WORK.IMPORT END =EOF;
FROM = "YOU@YOU.COM"
SUBJECT = "HOPE THIS WORKS!"
TYPE = "TEXT/HTML";
PUT '!EM_TO!' EMAIL;
PUT "I hope this works out for you.";
PUT '!EM_SEND!' / '!EM_NEWMSG!';
IF EOF THEN PUT '!EM_ABORT!';
This should send an email to each person seperatly until it reaches the end of the table.
If your getting the pop-up that asks your permission to send a email with outlook you need to adjust your SASV9.CFG file for SMTP instead of outlook:
Right above the area in the file that says something like:
| Warning: Install Application edits below this line. User |
| options should be added above ths comment |
This is what you want to add:
/* Note: Sets up email to use SMTP */
-emailhost EXCHANGEHOST.WHATEVER.WHATEVER.COM /* put your exchange server info here */
-emailport 25 /* 25 works for me, might have to check with your admin */