7

I have configured postfix to relay mail to Amazon SES by following their integration guide and sending email is working without issue.

However, I recently wrote a PHP application using a framework which produced a malformed email message.

SES rejects the email with "554 Transaction failed: Expected MIME type, got =" which is acceptable.

However, my local postfix server then attempts to send a sender non-delivery notification with a from=<> which gets pushed through to the relay address.

SES rejects stating "501 Invalid MAIL FROM address provided (in reply to MAIL FROM command))" and postfix removes the bounce message from the queue.

Question is, what is the easier way to ensure I get the original 554 bounce message sent to me? I don't see a way to make the SES relay accept empty from fields, so I believe the solution would lay in configuring postfix to deliver the bounce message directly to me.

Note, I use the term 'bounced mail' perhaps incorrectly. The mail is perhaps rejected but I'm not sure of the correct nomenclature for this scenario. The key point is that the message is not accepted by the SES relay, so it hasn't in fact gone 'out the door' so to speak.

Jun 12 03:11:21 myserver postfix/smtp[6353]: 411BA21795: to=<valid@validdomain.com>, relay=email-smtp.us-east-1.amazonaws.com[54.243.192.132]:25, delay=0.29, delays=0.05/0.02/0.15/0.07, dsn=5.0.0, status=bounced (host email-smtp.us-east-1.amazonaws.com[54.243    .192.132] said: 554 Transaction failed: Expected MIME type, got = (in reply to end of DATA command))
Jun 12 03:11:21 myserver postfix/cleanup[6351]: 93F202179B: message-id=
Jun 12 03:11:21 myserver postfix/qmgr[895]: 93F202179B: from=<>, size=4673, nrcpt=1 (queue active)
Jun 12 03:11:21 myserver postfix/bounce[6354]: 411BA21795: sender non-delivery notification: 93F202179B
Jun 12 03:11:21 myserver postfix/qmgr[895]: 411BA21795: removed

Jun 12 03:11:21 myserver postfix/smtp[6353]: 93F202179B: to=<valid@validdomain.com>, relay=email-smtp.us-east-1.amazona    ws.com[23.21.161.144]:25, delay=0.17, delays=0.01/0/0.15/0, dsn=5.0.0, status=bounced (host email-smtp.us-east-1.amazonaws.com[23.    21.161.144] said: 501 Invalid MAIL FROM address provided (in reply to MAIL FROM command))
Jun 12 03:11:21 myserver postfix/qmgr[895]: 93F202179B: removed
Gerald Schneider
  • 16,520
  • 9
  • 55
  • 76
Andy Fusniak
  • 1,154
  • 10
  • 25

2 Answers2

1

If you just need to get the Postfix bounce messages delivered to your inbox just set the next bounce related configuration params (/etc/postfix/main.cf file for Ubuntu):

# The list of error classes that are reported
notify_classes = bounce, delay, policy, protocol, resource, software

# The recipient of postmaster bounce notifications
bounce_notice_recipient = bounceuser

# The recipient of postmaster notifications about mail delivery problems that
# are caused by policy, resource, software or protocol errors.
error_notice_recipient = bounceuser

# The recipient of postmaster notifications with the message headers of mail
# that cannot be delivered within $delay_warning_time time units
delay_notice_recipient = bounceuser

bounceuser is the recipient that will get bounce related messages. If you need to forward the message to non-local recipient just edit /etc/aliases to make postfix forward the message to you:

# /dev/null will just delete the message from local
bounceuser: /dev/null, <YOUR_EMAIL_ADDRESS_HERE>

Don't forget to recreate the alias database and restart the postfix service:

sudo newaliases
sudo service postfix restart

^_^

Nacho Coll
  • 383
  • 6
  • 8
0

In order to received the bound message, you must set an envelope sender address which is delivered locally on your postfix installation.

Check

   postconf mydestination

to see which domains are delivered locally. Your application then needs to set the envelope sender address to a valid, locally delivered address. Something like root@name.of.your.machine

Ralf Hildebrandt
  • 456
  • 2
  • 13