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?


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


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_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.

  • 1
    They started supporting SMTP for SES only in December 2011. – AlexD Apr 20 '13 at 18:44

Or you could pre-process the forwarded message to rename all of the headers that Amazon doesn't like.


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/


I use header_checks and REPLACE action in postfix like so:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.