0

I've got two servers with the same setup. The first sends mails fine, the other one will not send mail. It appears the problem is the sender. When I send a local mail using:

echo 'Message' | mailx -s 'Test' [email protected]

in the postfix log it'll read:

from=<[email protected]>

whilst on the first server it is correctly reading:

from=<[email protected]>

I've checked /etc/hostname, /etc/hosts, verified the correct mydomain and myhostname with postconfig. The output of postconf -n is exactly the same:

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
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
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
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
relayhost = [host.relay.com]:587
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
smtp_use_tls = yes
unknown_local_recipient_reject_code = 550

The mail.cf is set to all defaults, except for adding the relayhost and the SASL stuff.

I tried setting the mydomain and myhost explicitly in main.cf but this seems to be ignored, just as putting root: [email protected] in /etc/aliases and then doing newaliases and restarting postfix does not change anything.

I've also tried sending an email with a PHP script, no difference.

The main.cf on server 1 is exactly the same as on server 2, they are both running the same system (CentOS 7) and software. The only difference is they are on different domains (ie. subdomain.domain1.com and subdomain.domain2.com), so that might be a possibility, but seems far fetched.

Yet, server 1 can send mail perfectly fine using the mailx command above, as well as from the aforementioned PHP script (which is nothing more than a simple mail() command.

What could cause postfix apparently ignoring domain/host settings, yet picking up on the correct values but insisting on adding the domain to the sender address?

1 Answer 1

0

The answer is DNS.

First clue was in the logs, where I noticed that it was actually sendmail, not postfix, that mentioned the wrong address first.

With some googling I found out that sendmail, when encountering errors resolving the domain, it apparently comes up with the host + domain combo. Checking my DNS config, I noticed 2 thing: I did not yet configure reverse DNS, and I did not specify the AAAA record (IPv6) for the subdomain which is used by the server.

After adding this, both sendmail and postfix where using the correct address, without the added domain.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .