BookmarkSubscribeRSS Feed
OS2Rules
Obsidian | Level 7

Hi All:

We have recently switched to Outlook as our e-mail system.  We also uses SAS to send SMTP e-mail messages.

How do I send an e-mail to 2 different people in the "to=" line?

Currently we use a macro variable to store the user address.  I think Outlook uses a semi-colon as the separator  to put between

the 2 addresses, but this becomes an invalid statement in SAS.

We code  -

call symput('emailaddr','name1@company.com;name2@company.com')   

to define the variable,

and then use:

FILE OUTBOXto="&emailaddr" 

but this does not work.

3 REPLIES 3
Quentin
Super User

Hi,

I would try a space-delimited list of quoted email addresses, in parentheses i.e.

file outbox to=("mail1@company.com"  "mail2@company.com") ;

HTH,

--Q

BASUG is hosting free webinars Next up: Mike Sale presenting Data Warehousing with SAS April 10 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
esjackso
Quartz | Level 8

Just a question, it doesnt look like you are dynamically making the macro variable for the address. If not why not just code directly to the to line? Also the semicolon (in the macro variable) after the macro variable is resolved is probably being read by SAS to end the coding line and thus creating syntax errors. As quentin points out, and if memory serves, spaces should work fine.

Just some thoughts.

EJ

NishunkSaxena
Calcite | Level 5

Try This code I hope it works for you I just tested it seems ok to me.

%let to_list="mail1@server.com" "mail2@server.com";

%let path=W:;

filename myemail email to=(&to_list.)

cc="mail3@server.com"

bcc="mail4@server.com"

subject="Sending mail through SAS"

attach=("path.\SAS_Code.sas" "&path.\Copy of SAS_Code.sas")

;

data _null_;

file myemail;

put "Hi,Please find attached the two SAS Files.Thanks,Nishunk";

run;

Thanks,

Nishunk

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2995 views
  • 0 likes
  • 4 in conversation