Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I have a fleet of Ubuntu clients running msmtp-mta along with heirloom-mailx. I'd like to have the same /etc/msmtprc on all machines.

At present, when someone uses mailx or sendmail, the mail will be from and the only clue to the client machine is the IP address in the mail header.

Is there a way to add the client host name to every mail sent? Like

  • Prepend it to the subject or
  • auto-attach a file to any mail or
  • change to (remember, one file to rule them all, and changes in host name should be met automatically)

Note: I cannot configure the actual SMTP-Server, just the msmtp client.

share|improve this question
You could try ssmtp instead of msmtp. I use msmtp myself, but you have to set the maildomain in the msmtprc for that; ssmtp uses the hostname directly I think. If you can settle for "the same msmtprc except for the maildomain", then should be possible with msmtp. –  frostschutz Apr 9 '13 at 17:31
Nice one, frostschutz! I would upvote you if I could! Note: I installed both (m|s)smtp, let msmtp provide sendmail so users can use mailx as they are used to. root and other reporting system accounts get a .mailrc that uses ssmtp as sendmail and hence provide the one-to-rule-them-all host name config /etc/ssmtp/ssmtp.conf. –  arney Apr 9 '13 at 21:41

Your Answer


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

Browse other questions tagged or ask your own question.