I want email to come from user@example.com
but they are currently coming from user@mail.example.com
From Postfix documentation:
What domain name to use in outbound mail
The myorigin parameter specifies the domain that appears in mail that is posted on this machine. The default is to use the local machine name, $myhostname, which defaults to the name of the machine. Unless you are running a really small site, you probably want to change that into $mydomain, which defaults to the parent domain of the machine name.
For the sake of consistency between sender and recipient addresses, myorigin also specifies the domain name that is appended to an unqualified recipient address.
Examples (specify only one of the following):
/etc/postfix/main.cf:
myorigin = $myhostname (default: send mail as "user@$myhostname")
myorigin = $mydomain (probably desirable: "user@$mydomain")
In /etc/postfix/main.cf I have:
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
Dispite what the documents said, my mail is showing as from user@mail.example.com
I have run sudo /etc/init.d/postfix restart
after making changes to the main.cf
file. Is there another parameter that needs to be set? I have read through the documentation and it seems pretty clear but my result is not consistent with what is described in the document. Thanks for any help.
ps, this is running on Ubuntu 14.04 on an Amazon ec2 instance, with an elastic IP and proper MX records. Mail is being both sent and received. I am sending mail using:
mail recipient@address.com
additional info, if it matters. At the command prompt:
user@mail:$ hostname
mail
user@mail:$ hostname -f
mail.example.com
user@mail:$ postconf myorigin
myorigin = $mydomain
user@mail:$ postconf mydomain
mydomain = example.com
Best Answer
Which do you use
mailutils
orbsd-mailx
?If the mail command of mailutils, you can specify the sender in the
-r
option.If the mail command of bsd-mailx, $myorigin setting is enabled.