Sending email with CC BCC and sender's address in unix mailx

Kyaw Lwin Phyo picture Kyaw Lwin Phyo · Apr 11, 2012 · Viewed 47.2k times · Source

I want to send email from HP unix using mailx command. I have to include cc and bcc in my email and have to use the specific email address as the sender.

But -r (which is to define the sender's email address) will disalbe ~ commands so if i have to define the sender's email address, i cannot use ~c and ~b commands for cc and bcc.

Is there any work around???? cos these are the requirements from the user.

Thanks.

Answer

mtk picture mtk · Dec 10, 2012

Just re-order the arguments to mailx command. That would give the desired result

$ echo "something" | mailx -s "subject" -b [email protected] -c [email protected]  -r [email protected] [email protected]