0

Being new to Linux I have followed this tutorial to set up a mail server:

https://www.digitalocean.com/community/articles/how-to-install-postfix-on-centos-6

Everything is working correctly however I am sending mail from: root@mail.example.com

I want mail just being sent from root@example.com, however when I change this section:

myhostname              = mail.example.com 
mydomain                = example.com

to

myhostname              = example.com 
mydomain                = example.com

Mail is not received. :(

What is causing this ?

Also, is there a way to change mail being sent from root to another prefix?

Thanks chaps.

2 Answers2

1

You cannot remove the FQDN from myhostname, that means the server no longer knows who it is.

The fact that mail sent from the machine directly lists itself as @fqdn is not odd, as it isn't postfix that is deciding that, it's the program sending the mail. The program sending the mail defines the FROM parameter, and the program that is sending root's mail is using your FQDN.

NickW
  • 10,183
  • 1
  • 18
  • 26
1

As NickW commented it is not a good idea to remove the fqdn from your hostname. If you are looking for the sender to appear as coming from root@example.com rather than root@mail.example.com, you have to edit the main.cf config file. The parameter you need to change is myorigin. In your case you can set it to $mydomain. Here is a snippet from postfix documentation.

/etc/postfix/main.cf:
     myorigin = $myhostname (default: send mail as "user@$myhostname")
     myorigin = $mydomain   (probably desirable: "user@$mydomain")
Daniel t.
  • 9,061
  • 1
  • 32
  • 36