I'm really not into mail configuration, but somehow I managed to configure exim4 and it does send e-mails. I spent so many hours on it though I even can't count. (And I don't know why it is so complicated, while needs are usually very similar: to have e-mails addresses which should be used to actually send e-mails - and that's almost everything, not taking into account a security subject, which is mostly related to authentication).

When I'm sending e-mail, I have automatically set a FROM field as 'root' (linux user). I'd like to have a custom field (e.g. "Contact me"), and I couln't find on internet any answer how to do this.

Second, some say that using linux users as related to email addresses is not a good thing e.g.: http://t-machine.org/index.php/2014/06/27/webmail-on-your-debian-server-exim4-dovecot-roundcube/ But the tutorials I found use them. I'm not using data base as in the url above, but I would still prefer to have no linux user related to email - is it something difficult to achieve? How could I do this?

Here's /etc/exim4/update-exim4.conf.conf content:

# /etc/exim4/update-exim4.conf.conf
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'
# Please note that this is _not_ a dpkg-conffile and that automatic changes
# to this file might happen. The code handling this will honor your local
# changes, so this is usually fine, but will break local schemes that mess
# around with multiple versions of the file.
# update-exim4.conf uses this file to determine variable values to generate
# exim configuration macros for the configuration file.
# Most settings found in here do have corresponding questions in the
# Debconf configuration, but not all of them.
# This is a Debian specific file

dc_other_hostnames='url.com; mail.url.com; url; localhost;  localhost.localdomain'
dc_local_interfaces='; my_ip'

For any case, I substituted my domain with url and ip with my_ip.

And /etc/email-addresses is very short:

root: [email protected]
  • Address rewriting is covered in chapter 31 of the Exim spec ... but it sounds like you're either writing a config completely from scratch, or you are ignoring all the help your distro has put in place. E.g., on Debian, dpkg-reconfigure exim4-config is about all you need to get email working and then editing /etc/email-addresses is how you easily configure rewriting. Could clarify what your setup is?
    – derobert
    Commented Dec 4, 2014 at 18:33
  • Not ignoring. I'm just a noobie in the subject. Anyway, updated question with a config file.
    – forsberg
    Commented Dec 4, 2014 at 18:56
  • Did you also edit the other config files? Also, what command are you using to send the email? Normally that's what generates the name (as opposed to email address, that rewriting changes).
    – derobert
    Commented Dec 4, 2014 at 19:02
  • Yes I configured other files, with accord to the tutorials. Test from here: digitalocean.com/community/tutorials/… - echo "This is a test." | mail -s Testing [email protected]. It works.
    – forsberg
    Commented Dec 4, 2014 at 19:10
  • Can't I just edit some file, adding to it "Contact me" and [email protected] ?
    – forsberg
    Commented Dec 4, 2014 at 19:17

2 Answers 2


You need to tell mail the name you'd like to use (its currently looking it up in /etc/passwd, most likely). Of course, you could also change the user full name in /etc/passwd (e.g., via chfn -f 'New Name' user, and you really ought not be sending the mail as root!

For Heirloom mail, you can use either the from environment variable, its mailrc config file, or the -r option. Like one of these:

echo 'This is a test.' | mail -r 'Contact Me <root>' \ 
                              -s 'Testing' '[email protected]'   # using -r argument

# ... or ...

echo 'This is a test.' | from='Contact Me <root>' mail \
                              -s 'Testing' '[email protected]'   # env var 'email'

For other versions of mail, check their manpages.

  • From what you wrote it seems that the "From" field in an email is set by Mail User-Agent (linux mail command), not by MTA (exim4)?
    – forsberg
    Commented Dec 5, 2014 at 14:00
  • @forsberg Yeah, From header typically comes from the MUA, but then the address part can be changed with rewriting.
    – derobert
    Commented Dec 5, 2014 at 14:16

The descriptive text in the From: address is taken from the password file. You can use the chfn command to change this. Try the command (change fullname and user ids as appropriate):

sudo chfn -f "Contact me" root

Ideally, you will have an alias for root in /etc/aliases specifying who should receive mail sent to root. This would likely be your userid, and any mail sent to root will be delivered to you mailbox.

Adding the same alias to /etc/email-addresses will change the address used in the From field. This should be a valid address as replies will be sent to this address.

  • Thanks. If I wanted to have a multiple e-mail addresses (e.g. [email protected] next to [email protected]), will I still have always the same descriptive From text (e.g. "Contact me") for each of them?
    – forsberg
    Commented Dec 5, 2014 at 13:48
  • @forberg Multiple from addresses are likely to trigger spam filters. I've only seen multiple from addresses in spam. Look at adding a Reply-to: address if you need multiple addresses.
    – BillThor
    Commented Dec 5, 2014 at 14:52
  • Well, I meant not multiple "From" email addreses within a single e-mail, but multiple e-mail addresses / accounts configured within a Linux :)
    – forsberg
    Commented Dec 9, 2014 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .