Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm thinking this is really really super simple, but I can't figure out what I need to do. I don't mess with Postfix much (Just let it run and do its thing) so I've got no idea where to even start with this.

We have postfix currently configured to relay all mail out through SES using the code below. We need to modify this so that emails sent from one of our domains (domain.com) DO NOT go through SES. Everything else should continue to flow out through the SES connection. I'm assuming this is like a one line thing but my google skills are not helping me at all.

relayhost = email-smtp.us-east-1.amazonaws.com:25
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_destination_concurrency_limit = 450

Update I have created sender_transport file in /etc/postfix. In it is @domain.com smtp: I then ran this through postmap and placed sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport above the above block of code and restarted postfix, but still all email is going out through SES.

Log after sending

Oct 22 14:38:48 web postfix/smtp[19446]: 4B19D640002: to=<kevin@mydomain.com>, relay=email-smtp.us-east-1.amazonaws.com[54.243.47.187]:25, delay=1.4, delays=0.01/0/0.92/0.44, dsn=2.0.0, status=sent (250 Ok 00000141e21b181f-ee6f7c4f-f0f5-4b0f-ba69-2db146a4f988-000000)
Oct 22 14:38:48 web postfix/qmgr[19435]: 4B19D640002: removed

I don't think this log is what you're looking for, but it's the only thing that is logged when mail goes out, and this is with me running /usr/sbin/postfix -v start manually and not with the init script.

share|improve this question
    
Post the complete logs of ONE mail sent with the above in place. –  adaptr Oct 22 '13 at 21:19

2 Answers 2

The parameter you need is sender_dependent_default_transport_maps:

sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transports

The above file should contain something like:

@thatdomain.example.com    smtp:

Don't forget to postmap the file.

Reference: the relayhost documentation.

EDIT:

I see you also require smtp encryption for all outgoing traffic.
This will not work when the relayhost is not always used.

Far better to make Amazon the exception (this will make sense later) and apply the relayhost and TLS to that one transport only.

For now, just set

smtp_tls_security_level = may

to test if it works.

share|improve this answer
    
I've managed to stumble this far just now but it's still not working. All email is still going out via SES. I placed the sender_dependent.... line above the above block of code. Should it be below it? I think I'm close but the above block is overriding this line. –  Kevin Oct 22 '13 at 21:12
    
The order of configuration parameters has no impact on postfix, except if you were to define one before you use it. –  adaptr Oct 22 '13 at 21:18
    
That's what I thought, but for some reason the line is having 0 impact. –  Kevin Oct 22 '13 at 21:19
    
I've posted a log, but it doesn't have much information in it. –  Kevin Oct 22 '13 at 21:53
    
The block is literally copy and pasted from Amazon's setup instructions. They require encryption for all of their connections. I just set smtp_tls_security_level = may and restarted postfix. No change, emails still going out through SES. –  Kevin Oct 22 '13 at 22:01

sender_dependent_default_transport_maps (default: empty)

A sender-dependent override for the global default_transport parameter setting. The tables are searched by the envelope sender address and @domain. A lookup result of DUNNO terminates the search without overriding the global default_transport parameter setting. This information is overruled with the transport(5) table. [...]
This feature is available in Postfix 2.7 and later.

share|improve this answer
    
How does this explain what he should do ? –  adaptr Oct 22 '13 at 21:07
    
I literally just now stumbled across this setting and sender_dependent_relayhost_maps, but I'm not really clear on either of their usages. Can you perhaps provide some more info on how I would implement this? I am very green when it comes to Postfix. –  Kevin Oct 22 '13 at 21:08
    
adaptr response contains usage example. –  Andrzej A. Filip Oct 22 '13 at 21:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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