Mailx issue; email address starting with #

Hello All,

I have a requirement to generate report and send them to a distribution list.
The problem I am facing is when sending out the email using mailx.
The email address (DL) we have is starting with # and because of this it's not recognising the email and throwing the below error.

Error"Send options without primary recipient specified"

When I try to put the email under "" then no email has been send out.

Appreciate your suggestions on this issue.

Thanks.

 

RECIPIENT=$RECIPIENT"#AppMIReporting@domain.com";

echo "$BODY" | mailx -r "$SENDER" -s "$SUBJECT" -a "$ODFILENAME" -a "$LOFILENAME" "$RECIPIENT"

Hello Pradeep_Raj ,

A few questions first, I'm afraid:-

  • What OS and version are you using?
  • Have you tried escaping the # with a \ like this:-
    RECIPIENT=$RECIPIENT"\#AppMIReporting@domain.com"
  • What is the value of $RECIPIENT before you start?

Thanks, in advance,
Robin

1 Like

Hi Robin,

I did a echo and could see $RECIPIENT has the full email address as the value.
I tried with escape / with no luck.

OS and Version:
Linux servername 2.6.32-358.18.1.el6.x86_64 #1 SMP Fri Aug 2 17:04:38 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux

Appreciate your suggestion on this issue.

Thanks,
Pradeep