BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Azeem112
Quartz | Level 8

I've a macro variable as

 

 

%let emails = "A@sas.com B@sas.com";

 

options emailsys=smtp emailhost=domain.com  emailport=25; 
			filename outbox EMAIL;

			data _null_;
				
				file outbox
				TO=(&emails)
				FROM =('sas_noreply@domain.com') 
				type="text/html"
				subject=("SAS ALERT:");

				put '<html>';
				put '<body>';
				put '<div>';
				put '<p>Message Body</p>
				put '</div>';
				put '</body>';
				put '</html>';
			run;

and I'm sending it using the upper code

I receive the error that email is bad.

 

I've tried

"'a@sas.com' 'b@sas.com'"

"a@sas.om b@sas.com"

("a@sas.om b@sas.com")

 

Kindly provide support. 

Please note, I've only a macro variable containing list of comma separated emails.

 

 

 

Comma separated mails are working in "CC" but in "TO" system throws error

 

ERROR: Email: 501 Syntax error, parameters in command "RCPT
       TO:<a@sas.com,b@sas.com>" unrecognized or missing
WARNING: Bad e-mail address: (a@sas.com,b@sas.com)
WARNING: No email addresses specified.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Just a tiny change in your %let:

%let emails = "A@sas.com" "B@sas.com";

and

filename outbox email
  to=(&emails)
  from =('sas_noreply@domain.com') 
  type="text/html"
  subject=("SAS ALERT:")
;

data _null_;
file outbox;

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

Just a tiny change in your %let:

%let emails = "A@sas.com" "B@sas.com";

and

filename outbox email
  to=(&emails)
  from =('sas_noreply@domain.com') 
  type="text/html"
  subject=("SAS ALERT:")
;

data _null_;
file outbox;
s_lassen
Meteorite | Level 14

I think your macro variable should contain a list of quoted mail adresses, e.g.

%let emails="A@sas.com" "B@sas.com";
TO=(&emails)
Azeem112
Quartz | Level 8

Thanks a lot Everyone for Quick response. It's working. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 15923 views
  • 0 likes
  • 3 in conversation