I have installed mailutils on Ubuntu 12.10 and I have run into a problem where the domain being attached is the fully qualified host and not just the domain. For example,

mail user2 [enter] then enter message and send produces a from address of user1@host.domain.com

I want the from address to be just user1@domain.com. I did not have this problem in 12.04, it only started when I upgraded to 12.10. Is there a system config file somewhere that would allow me to only set the domain.com as being added to the username when sending mail and not the full host name?

Thanks, Tim


To use a local domain other than the hostname in Mailutils:

Create a file /etc/mailutils.conf with the following contents:

address {
  email-domain somedomain.com;

You can see what else can be configured in mailutils.conf with:

$ mail --config-help
  • Thanks for this helpful answer to an old question. – Andrew Schulman May 29 '19 at 21:59
  • Doesn't work on Ubuntu 18.04/mailutils 2.99.99. What version are you using? – Niklas Holm Nov 29 '19 at 13:08
  • Doesnt work on 18.04 here either. – mmm Feb 13 at 11:13
  • It worked fine for me in 18.04 back in 2018 and is still working in 20.04 and 20.10. – rustyx Feb 13 at 11:18

Frustratingly there is no easy generic mailutils configuration file way to do what you are asking (have the mail program from mailutils use a different default domain through said configuration file).

FWIW I've found that mailutils mail crafts addresses that look like user@host when sending a mail to just 'user' before the mail is given to the MTA. Thus how the FQDN is actually created was down to the MTA configuration (e.g. you can configure some MTAs to always append the contents of /etc/mailname thus creating other problems). That might explain why other answers on this question linked to the other answers explaining how to make to force headers when using mail (e.g. https://stackoverflow.com/a/380573/4513656 ).

  • Using mailutils.conf as described by @rustyx would appear to answer the question. – TommyPeanuts Nov 3 '19 at 9:35
  • @TommyPeanuts not on modern Ubuntu – Niklas Holm Nov 29 '19 at 13:24
  • @NiklasHolm Are you sure? I've just tried it on 18.04 and it works fine. – TommyPeanuts Nov 30 '19 at 8:21
  • /etc/mailname ! – Martin T. Jan 25 at 11:10

You can do this by changing the hostname, or using the -F option of the mail command.

See also https://stackoverflow.com/questions/54725/change-the-from-address-in-unix-mail

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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