Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got msmtp setup on Ubuntu 10.10 so that cron can send me emails. That works like a champ, for the most part.

However, emails coming to my gmail account show up as coming from (unknown sender), and the headers show:

From: root (Cron Daemon)

How can I set the From header to a valid email address?

I've just got msmtp symlinked as /usr/sbin/sendmail

The one possible solution I've found is here:

However, I'm curious if there's a simpler way.

share|improve this question

No problem. Just configure it like mentioned in the manual:


should add to all mails without domain set.

share|improve this answer
This only allows me to set the from email based on the user. It doesn't set the actual header that gmail reads. Currently I'm specifying the from address in the msmtprc. Without a valid from email, it keeps all my cron emails to spam, and I have to explicitly override it with a filter. – Jason Navarrete Oct 13 '11 at 19:16

You can use -a switch in order to specify additional headers. And an additional header can be From, so it's just what you need.


/ | mail -s "Email subject" -a "From:Sender Name <>"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.