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.

I am setting up a linux server that I want to send mail independently of our main mailserver (ie. directly). The problem is, when I send mail to an external address, it bounces with the message domain of sender address does not exist. (it is sending the mail as root@domain.local)

What is the proper way to change the domain of my email sender?

share|improve this question
    
Setting $myorigin to our internet domain name appears to fix the problem - not sure if this is the "proper" way to do this. –  Brent Jun 22 '09 at 19:54
    
Should work fine if you won't be changing it often. Other way is to set the hostname on the server to a valid mail domain name. –  Dave Drager Jun 22 '09 at 19:55

4 Answers 4

up vote 3 down vote accepted

In main.cf:

# SENDING MAIL
# 
# The myorigin parameter specifies the domain that locally-posted
# mail appears to come from. The default is to append $myhostname,
# which is fine for small sites.  If you run a domain with multiple
# machines, you should (1) change this to $mydomain and (2) set up
# a domain-wide alias database that aliases each user to
# user@that.users.mailhost.
#
# For the sake of consistency between sender and recipient addresses,
# myorigin also specifies the default domain name that is appended
# to recipient addresses that have no @domain part.
#
#myorigin = $mydomain
myorigin = $myhostname

This is the default setup. If your hostname is domain.local this is probably why you are seeing that as sender domain.

share|improve this answer
    
correct, my hostname is domail.local (in this example) –  Brent Jun 22 '09 at 19:50

You need to fix your domain name in the postfix configuration (domain.local is not a valid domain name).

Check /etc/postfix/main.cf, there are a few ways this can be specified, this may help: http://www.postfix.org/BASIC_CONFIGURATION_README.html#myorigin

share|improve this answer

This is one of those issues that you will need to involve/bribe/blackmail your DNS admin for assistance on as you will want the name your server claims when trying to send to be correct. Mnay servers will bounce your mail if the sender doesn't correctly resolve both forward and reverse.

For example, let's say your server is mail01.example.com. When your server, with the $myorigin correctly configured to advertise as mail01.example.com, contacts my server, my server will do a DNS lookup of of the IP address you're connecting from and will expect the lookup to match the name your giving me. If it does not correctly resolve, then I will sever the connection because you're probably just sending me spam.

share|improve this answer

You have to configure your postfix with smarthost because some destination servers verify if the sender address exists.

How to do it here: http://ubuntu.wordpress.com/2005/09/07/setting-a-smarthost-in-postfix/

share|improve this answer
    
Actually, this was how it WAS set up. This is a nagios server, and my goal is to remove its dependency on the mailserver (smarthost). Therefore, I need some way for it to send email directly to our admins via their external email addresses. –  Brent Jun 22 '09 at 19:44

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.