0

We use Postfix on our CentOS 6 machine, having the following configuration. We use PHP's mail() function to send rudimentary password reset emails, but there is a problem.

As you will see, mydomain and myhostname is correctly set, afaik.

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 = ***.ch
myhostname = test.***.ch
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

Now this is the stuff that is in the /var/log/maillog of Postfix upon sending an email to ***.***@***.ch, with ***.ch being the same domain our sending server test.***.ch is on:

Dec 13 16:55:06 R12X0210 postfix/pickup[6831]: E6D6311406AB: uid=48 from=<apache>
Dec 13 16:55:06 R12X0210 postfix/cleanup[6839]: E6D6311406AB: message-id=<20121213155506.E6D6311406AB@test.***.ch>
Dec 13 16:55:07 R12X0210 postfix/qmgr[6832]: E6D6311406AB: from=<apache@test.***.ch>, size=1276, nrcpt=1 (queue active)
Dec 13 16:55:52 R12X0210 postfix/smtp[6841]: E6D6311406AB: to=<***.***@***.ch>, relay=mail.***.ch[**.**.249.3]:25, delay=46, delays=0.18/0/21/24, dsn=5.0.0, status=bounced (host mail.***.ch[**.**.249.3] said: 550 Sender Rejected (in reply to RCPT TO command))
Dec 13 16:55:52 R12X0210 postfix/cleanup[6839]: 8562C11406AC: message-id=<20121213155552.8562C11406AC@test.***.ch>
Dec 13 16:55:52 R12X0210 postfix/bounce[6848]: E6D6311406AB: sender non-delivery notification: 8562C11406AC
Dec 13 16:55:52 R12X0210 postfix/qmgr[6832]: 8562C11406AC: from=<>, size=3065, nrcpt=1 (queue active)
Dec 13 16:55:52 R12X0210 postfix/qmgr[6832]: E6D6311406AB: removed
Dec 13 16:55:52 R12X0210 postfix/local[6850]: 8562C11406AC: to=<root@test.***.ch>, orig_to=<apache@test.***.ch>, relay=local, delay=0.13, delays=0.07/0/0/0.05, dsn=2.0.0, status=sent (delivered to mailbox)
Dec 13 16:55:52 R12X0210 postfix/qmgr[6832]: 8562C11406AC: removed

So the receiving server rejects the sender (line 4 of log output). We have tested it with one other recipient and it worked, so this problem might be completely unrelated to our settings, but related to the recipient.

Still, with this question, I want to make sure we're not making an obvious misconfiguration on our side.

3 Answers 3

1

First, you should inform the PHP mail() function who is the sender of the mail, if you do not do that it will take the name of user that is running PHP and add @test.*****.ch to it and I guess test.****.ch does not have an MX record and is not used for receiving mail.

Now for the general advice:

When dealing with satellite mail boxes that just send mail this is my approach (when you do not have test.***.ch as a separate mail domain).

On the main mail server I create an account for sending mail for each of my servers, I use this accounts information to relay all mail to the main mail server so he can take care of the further delivery. To set this up take a look at smtp_sasl options.

After that create a file /etc/postfix/generic with the following content:

@test.*****.ch  server.test@*****.ch

and run:

postmap hash:/etc/postfix/generic

Now add to your main.cf file:

smtp_generic_maps = hash:/etc/postfix/generic

And for good measure forward mail for root (via /etc/aliases or /root/.forward) to redirect all mail for root to the system admins email address.

Of course you need to restart Postfix after all this.

All this takes care of couple of problems:

  1. All mail coming from the system has test.*****.ch as the domain, by creating a generic map we tell Postfix to replace test.*****.ch with *****.ch which is a valid email domain with an MX
  2. Since we are authenticating to the remote mail server we can probably skip a lot of checks that non authenticated users can not
  3. Mail for root gets redirected to the correct mailbox
0

As far as I can tell, the destination server does not like the sender apache@test.***.ch

You could try to add myorigin = $mydomain to Postfix main.cf configuration file

0

IS the receiver domain doing sender verification? and if so does test.xxxxx.ch have correct DNS and or MX records. What do the logs on the receiving host say, as they will provide more information. I would make sure that test.xxxx.ch has proper dns/mx, and accepts an incoming connection that will respond to a RCPT TO for [email protected], so that when the receiving host attempts to do a sender verify it will pass.

You must log in to answer this question.

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