Command line sending mail with different "From"?

I followed the linode library article of setting up Exim4 on Ubuntu 10.04. I am able to send e-mail out fine.

My question is how do I specify a different "From" address for the e-mail on the command line?

I am doing this for simple testing purposes and the fact that I have multiple domains pointing to the same server.

3 Replies

mail -a "From: Fake Person <>"

Thank you! That worked. After testing this it brought up another question. When viewing the raw text of the e-mail message sent using this it will show it came from my original domain name (what is displayed by hostname -f):

Received: from ([])

Is it possible for it to show the domain that I am actually sending from? I have two virtual hosts/domains served by Apache and the "Received: from" would always indicate the hostname -f even when I send an e-mail that is supposed to appear from the other domain. The From field displayed in the e-mail client does display correctly.

Not generally; your system has one hostname, which is used to identify itself whenever it needs to know its name. The best workaround might be to use a hostname under another, neutral domain (like a domain for your company/department, if other companies or departments are your "customers"). If worse comes to worse, the default hostname works too.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct