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 trying to set up an outgoing mail server for sending emails which is to relay to our ISP.

In /etc/postfix/main.cf I have myhostname to ourcompany.example.com and myorigin and mydomain to $myhostname. ourcompany.example.com is resolvable.

But looking at the logs in /var/log/maillog it appears that postfix does use the myhostname for the send address, but uses whatever from getmyhostname(), which is set to an internal DNS name since this is an internal server and we only send email out, but not handling incoming email.

Any ideas?

EDIT: postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = example.com
myhostname = ourcompany.example.com
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.5/README_FILES
relayhost = smtp.grapevine.com.au
sample_directory = /usr/share/doc/postfix-2.6.5/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

Where both ourcompany.example.com and example.com are public domains are resolvable by anyone, therefore should be resolvable by my ISP. The problem isn't the domain, but the fact that postfix is not using it, I am getting logs like:

May 26 10:23:22 localhost postfix/smtp[3910]: 449AF5803F6: to=<tesing@example.com>, relay=smtp.grapevine.com.au[203.129.32.140]:25, delay=63275, delays=63274/0.02/0.04/0.4, dsn=4.1.8, status=deferred (host smtp.grapevine.com.au[203.129.32.140] said: 450 4.1.8 <benny@server.internal>: Sender address rejected: Domain not found (in reply to RCPT TO command))

It is using server.internal instead of $myorigin, and server.internal is what you get from calling gethostname(), and it is an internal hostname and is not resolvable on the public internet.

So my question is this, how do I set postfix to use example.com instead of using gethostname()? My thinking was that gethostname() is only used when I leave myorigin, mydomain and myhostname empty, but setting them to the above setting doesn't do anything.

share|improve this question
    
Post the relevant log entries and the output of postconf -n. –  joschi May 25 '10 at 9:01
    
Have added log entries where I had problem and postconf -n. –  sunny.oxide May 26 '10 at 0:43
    
I am having the same problem and have not yet been able to fix it: superuser.com/questions/499208/… –  daveagp Nov 3 '12 at 23:47
add comment

3 Answers

mydomain = example.com
myorigin = $mydomain

By default, the option append_at_myorigin is set to yes, which means that any and all outgoing mail that has no domain component will get the value of myorigin appended.

In your case, that is the domain name, and not the hostname.

Always send mail using fully-qualified addresses, i.e. containing both a localpart and a valid, existing domain/hostname part.

If for some reason you cannot, use one of the methods described in the Address Rewriting Readme

share|improve this answer
add comment

Are you sure that it is not your relay that determine the name of your server by DNS ? Like Joschi, could you give us logs, postconf -n, and maybe mail headers.

share|improve this answer
    
Yes it is the relay that determine the name of my server, but that postfix isn't using the domain in the configuration but a local domain!! Please see added info above! –  sunny.oxide May 26 '10 at 0:45
add comment

connect to your server with telnet on port 25, you will see a string that definitively tells you whether or not it's actually using myhostname.

My suspicion is that you simply haven't set address masquerading up properly.

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.