Saturday, May 29, 2010

using mailx from command line

*) Using mailx for sending mail:

echo "this is a mail body\n~c" | mailx -s "my subject"

This will send mail
Subject: my subject

this is a mail body
the '\n~c' will add the recipient to Cc list, as '~' tilde option only recognized by mailx cmd if present at start of line