2

I am running postfix using Amazon SES as the mail transport. Mail is sent out fine, however when I receive mail and try to forward it using a virtual alias, I get this error in the mailog:

 (Command died with status 1: "/ses/ses-send-email.pl". Command output: Illegal header 'Delivered-To'. )

I see that SES does not support the 'Delivered-To' header so how can I forward email? I have softbounce ON if that means anything, maybe turning it off will work?

Steffen Opel
  • 5,560
  • 35
  • 55
john
  • 249
  • 1
  • 6
  • 11

5 Answers5

3

I know this question is a year old but why use the script when Postfix handles relaying through SES just fine using SMTP.

You can either setup your relayhost if the only email being sent is from a verified sender or verified domain or you can use sender_dependent_relayhost_maps to relay only those domains and senders verified.

In either case you would start by setting up the SASL password for SMTP AUTH. I use /etc/postfix/sasl_password and it should follow the format of:

email-smtp.us-east-1.amazonaws.com    SES-USER:SES-USER-PASSWORD

Update to use the SMTP host from your AWS SES Console and the appropriate SES SMTP user credentials. Next you need to configure the SMTP SASL client settings in /etc/postfix/main.cf by adding the following:

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
smtp_sasl_security_options=noanonymous
smtp_sasl_mechanism_filter = login

Now run postmap /etc/postfix/sasl_password and that is all set. Now you have to decide if you're relaying everything or just verified senders/domains. If relaying everything then simply add the following to your main.cf:

relayhost = email-smtp.us-east-1.amazonaws.com

On the other hand if you only want to send verified senders/domains then add the following to your main.cf instead:

sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_maps

Then in /etc/postfix/relayhost_maps add your verified senders/domains following the format of:

verified@example.com    email-smtp.us-east-1.amazonaws.com
@example.net            email-smtp.us-east-1.amazonaws.com

Run that file through postmap /etc/postfix/relayhost_maps and do a postfix reload and you should be sending emails through SES.

Jeremy Bouse
  • 11,241
  • 2
  • 27
  • 40
2

You could specify prepend_delivered_header = file to disable inserting 'Delivered-To' header when forwarding. See documentation for details.

AlexD
  • 8,179
  • 2
  • 28
  • 38
1

You can edit ses-send-email.pl to convert illegal headers to X- headers.

Check here for sample code: http://www.evanhoffman.com/evan/2011/08/02/amazon-ses-illegal-headers-with-ses-send-email-pl-followup/

Evan
  • 11
  • 1
1

I use header_checks and REPLACE action in postfix like so:

/^(Delivered-To:.*)$/ REPLACE X-$1

Shrike
  • 11
  • 1