Skip to content

Sendmail – Set From Address

March 12, 2008

For years I have had to build the email header in a file in order to set the From address with sendmail. After some tinkering I devised a method of sending an email using a one liner. I have to admit, it is slick:

echo “Hello World” | formail -A ‘Subject: Test Subject!’ -A ‘From: sender@domain.com’ -A ‘To: recipient@domain.com’ | sendmail -oi -t

You may have to prefix echo, formail, and sendmail with paths if they aren’t in your own path.

Advertisement

From → Linux

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.