Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

unix

email

mailx

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.

like image 730
Kyaw Lwin Phyo Avatar asked Apr 11 '12 04:04

Kyaw Lwin Phyo


People also ask

How do you CC in mailx?

After the content is written, press Ctrl+D & EOT will be displayed by mailx. We can send a carbon copy (CC) or a blind carbon copy (BCC) to send the same email to multiple recipients (visibly or in a hidden manner).

How does mailx work in Unix?

mailx puts the completed message into a file called the recipient's system mailbox. The message stays in the system mailbox until the recipient asks to read the message. At that point, the message is obtained from the system mailbox and displayed on the recipient's workstation.

How do you cc an email in Unix?

Sending a simple mailRun the command below, to send an email to [email protected]. The s option specifies the subject of the mail followed by the recipient email address. The shell asks for the 'Cc' (Carbon copy) field. Enter the CC address and press enter or press enter without anything to skip.


1 Answers

In my case I have to keep multiple id's in cc which has been done by giving the email-id's comma separated one by one as below:

$ echo -e "Hi Team, \n \n Action Needed \n \n Regards, \n XYZ team"| mailx -s "subject" -b [email protected],[email protected] -c [email protected],[email protected] -r [email protected] [email protected]

Also made use of the echo command to pass multiple lines to mailx utility. Thought it will be helpful.

like image 137
Ajeesh Varghese Avatar answered Oct 24 '22 01:10

Ajeesh Varghese