Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
How are you sending the email? –  Khaled Feb 5 '13 at 15:00
    
Through the command line itself. Using mailx. –  Ghillie-Up Feb 5 '13 at 15:13
add comment

2 Answers

up vote 1 down vote accepted

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")
share|improve this answer
    
Thanks man :) Worked a treat. –  Ghillie-Up Feb 5 '13 at 17:17
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.