Send mail from command line from specific email address

in

In an email, from is set in the header. To set FROM in any email sent through the mail command, here is the syntax

echo 'Mail body' | \
mail -s 'this is the email subject' -a 'From: sender@example.com' receiver@example.com

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".
  • Easily link to terms in various wikis. For help, see <a href="/interwiki/1">interwiki</a>.

More information about formatting options