title: How to receive bounced mail using AWS SES With Postfix
body: <p>I have configured postfix to relay mail to Amazon SES by following their integration guide and sending email is working without issue.</p>
  
  <p>However, I recently wrote a PHP application using a framework which produced a malformed email message.</p>
  
  <p>SES rejects the email with "554 Transaction failed: Expected MIME type, got ="  which is acceptable.</p>
  
  <p>However, my local postfix server then attempts to send a sender non-delivery notification with a from=&lt;> which gets pushed through to the relay address.</p>
  
  <p>SES rejects stating "501 Invalid MAIL FROM address provided (in reply to MAIL FROM command))" and postfix removes the bounce message from the queue.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <pre>
  Jun 12 03:11:21 myserver postfix/smtp[6353]: 411BA21795: to=&lt;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=&lt;>, 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=&lt;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
  </pre>