DATA Step, Macro, Functions and more

Issue with email ID list for EMAIL engine in FILENAME statement

Reply
Contributor
Posts: 37

Issue with email ID list for EMAIL engine in FILENAME statement

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.

Regular Contributor
Posts: 233

Issue with email ID list for EMAIL engine in FILENAME statement

Check this link out. It has some info related to this topic.

http://support.sas.com/techsup/technote/ts605.html

Regular Contributor
Posts: 233

Issue with email ID list for EMAIL engine in FILENAME statement

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.

Contributor
Posts: 37

Issue with email ID list for EMAIL engine in FILENAME statement

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..

Super User
Super User
Posts: 7,046

Issue with email ID list for EMAIL engine in FILENAME statement

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?

PROC Star
Posts: 7,473

Issue with email ID list for EMAIL engine in FILENAME statement

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.

Contributor
Posts: 37

Issue with email ID list for EMAIL engine in FILENAME statement

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?!!

PROC Star
Posts: 7,473

Issue with email ID list for EMAIL engine in FILENAME statement

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.

Super User
Super User
Posts: 7,046

Issue with email ID list for EMAIL engine in FILENAME statement

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.

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002058232.htm

filename testmail email 'me@myhost' cc=

("id1@address1"

  "id2@address2"

....

);

That format is easy to generate with a data step from your database of addresses.

filename code temp;

data _null_;

    set cclist end=eof;

    file code;

   if _n_=1 then put 'filename testmail email '  email $quote. 'cc=' ;

    else put ' ' email $quote. ;

    if eof then put ');';

run;

You might also try sending an email with your normal email tool and see if the limit is in your mail server instead.

New Contributor
Posts: 3

Re: Issue with email ID list for EMAIL engine in FILENAME statement

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 */

PROC IMPORT

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 */

RUN;

/* let send out the email to everyone */

FILENAME OUTBOX EMAIL;

DATA _NULL_;

SET WORK.IMPORT END =EOF;

FILE OUTBOX

FROM = "YOU@YOU.COM"

SUBJECT = "HOPE THIS WORKS!"

TYPE = "TEXT/HTML";

PUT '!EM_TO!' EMAIL;

PUT "Hello!";

PUT "<br><br>";

PUT "I hope this works out for you.";

PUT '!EM_SEND!' / '!EM_NEWMSG!';

IF EOF THEN PUT '!EM_ABORT!';

RUN;

RUN;

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 |

|               box.....

This is what you want to add:

/* Note: Sets up email to use SMTP */

-emailsys 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 */

Ask a Question
Discussion stats
  • 9 replies
  • 288 views
  • 6 likes
  • 5 in conversation