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.
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;
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;
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)
Thanks a lot Everyone for Quick response. It's working.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.