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: [email protected]

I want mail just being sent from [email protected], 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
  • How are you sending the email?
    – Khaled
    Feb 5, 2013 at 15:00
  • Through the command line itself. Using mailx.
    – user155551
    Feb 5, 2013 at 15:13

2 Answers 2

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 [email protected] rather than [email protected], 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")
0
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.

You must log in to answer this question.