Score:0

Postfix on Ubuntu sending email from [email protected] instead of [email protected]

us flag

This appears to be a common issue but none of the solutions I've come across seem to be working. I'm using Ubuntu 18.04 LTS and mailutils / postfix. My /etc/postfix/main.cf looks like this:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
mydestination = $myhostname, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all

My /etc/aliases has the following entry:

root: [email protected]

Note I want mail to default to [email protected] when I don't specify a from address. Any suggestions are welcome! I've tried this and this but no success

Score:2
ar flag

Postfix doesn't send mail.

It transfers mail to other servers and receives mail from other servers.

Sender is specified by the Mail User Agent, not the Mail Transfer Agent. Set whatever sender you want in whatever software you use to send the e-mail to Postfix for handling.

For mailutils' mail command, a man mail is suggested reading:

from The address (or a list of addresses) to put into the `From:' field of the message header. If replying to a message, these addresses are handled as if they were in the alternates list. If the machine's hostname is not valid at the Internet (for example at a dialup machine), either this variable or hostname have to be set to get correct Message-ID header fields. If from contains more than one address, the sender variable must also be set.

Try mail -a FROM:[email protected] [email protected] as a test of how to set the sender.


If you're really set on fixing this in the wrong place, you can always have a look at how Postfix can rewrite e-mail addresses. Masquerade is probably what you want:

masquerade_domains = example.com

should strip foo.example.com to example.com. But please; don't go this route. Fix the problem at the origin; the MUA that sends the e-mail to Postfix.

R2Bleep2 avatar
us flag
I was explicit about using mailutils in conjunction with postfix above. In light of your answer, my question is: how do I have the mail bash utility send from [email protected] when I don't specify a from address?
vidarlo avatar
ar flag
`-a FROM:[email protected]` will change the sender for mail in mailutils...
R2Bleep2 avatar
us flag
So mailutils cannot be configured to do that without being explicit about the from address?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.