Tags

,

1. If the message isn’t too long then type the following in the commandline and hit enter

$ mail -s "Subject of the email" -c cc_recipient@domain1.com -b bcc_recipient@domain2.com main_recipient@domain3.com -- -F"Sender Name" -fSender@domain4.com

Then keep typing your message. To send it either enter a blank line with just a single period (“ . ”’) in it and hit enter again, or just hit control+d. That’s it! A email to main_recipient@domain3.com has been sent with a carbon copy (cc) to cc_recipient@domain1.com and a blind carbon copy (bcc) to bcc_recipient@domain2.com. The recipients will see the message from “Sender Name” who has email address Sender@domain4.com.

The sendmail flags (-f and -F) come after the -- sign. Notice that there is no space between the sendmail flags and the corresponding arguments.

Needless to say, you may skip the cc and bcc fields.

2. If the message is fairly long you may want to compose it in a text file, say message.txt, using a convenient editor. Send the email with the body of the email as the text in message.txt as follows

$ mail -s "Subject of the email" -c cc_recipient@domain1.com -b bcc_recipient@domain2.com main_recipient@domain3.com -- -F"Sender Name" -f sender@domain4.com < message.txt

3. In order to send a file as attachement (say, attachment.pdf) use the following

$ uuencode attachment.pdf  attachment_name_that_the_reciepents_will_see.pdf | mail -s "Subject of the email" -c cc_recipient@domain1.com -b bcc_recipient@domain2.com main_recipient@domain3.com -- -F"Sender Name" -f sender@domain4.com < message.txt

Update: If -F and -f flags are used together only -f and its argument are used. Weird!