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

I'm running into an issue where one of my recipients has a "-" in their email address when I'm setting it up in %LET EMAIL_TOLIST=

 

"ERROR 23-2: Invalid option name" is the error message that pops up.

 

Is there a way to work around this? 

1 ACCEPTED SOLUTION

Accepted Solutions
LeonidBatkhan
Lapis Lazuli | Level 10

Try using to=(&EMAIL_TOLIST) as in

filename mymail email to=(&EMAIL_TOLIST) type='text/html' subject='Test';

You can still place your code replacing partial email address and real server names with valid characters e.g. XXXXX, not ***** which as not valid for server and email names.

View solution in original post

6 REPLIES 6
Sheu
Fluorite | Level 6

<

49 %LET EMAIL_TOLIST= 'abc-abc@*****.com';
50
2 The SAS System 13:37 Wednesday, April 1, 2020

51
52
53 options emailsys=smtp emailhost=intmail.*****.net emailport=25;
54 filename mymail email &EMAIL_TOLIST
55
56 type='text/html'
NOTE: Line generated by the macro variable "EMAIL_TOLIST".
56  'abc-abc@*****.com'
_______________________________
23
ERROR 23-2: Invalid option name 'abc-abc@*****.com'.

57 subject='Test';
ERROR: Error in the FILENAME statement.

/>

LeonidBatkhan
Lapis Lazuli | Level 10

I don't think "-" is a problem. What are your asterisks ***** in the emailhost and why it's not quoted?

Can you please place your code to show what exactly you run?

Sheu
Fluorite | Level 6

The code works fine if I use a different email address though. 

 

I'm just censoring out the email host name in case it's sensitive.

LeonidBatkhan
Lapis Lazuli | Level 10

Try using to=(&EMAIL_TOLIST) as in

filename mymail email to=(&EMAIL_TOLIST) type='text/html' subject='Test';

You can still place your code replacing partial email address and real server names with valid characters e.g. XXXXX, not ***** which as not valid for server and email names.

Sheu
Fluorite | Level 6

Thank you for the help!

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

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

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 3393 views
  • 2 likes
  • 3 in conversation