I use Amazon SES service as a relay. I control which sasl clients send through 
amazon with:

main.cf:
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay_host
A typical entry is:
@example.com email-smtp.eu-west-1.amazonaws.com:25
master.cf:
smtp      inet  n       -       -       -       -       smtpd

So if a client domain is in sender_relay_host then their outbound mail goes via amazon relay, otherwise postfix sends it directly to the recipient MX.

But Amazon has a message size limit of 10MB so to allow a client to send larger emails I have to comment them out of the sender_relay_host so they are only subject to the the Postfix message size limit - in my case 40MB.

I want to be able to have messages sent out directly if they are greater than 8MB, bypassing the relay, so I have taken the following action after reading Wietse's instructions in http://comments.gmane.org/gmane.mail.postfix.user/205963:

I have the policy daemon postfwd running with the following entry:

id=RULE-SIZE-RELAY; protocol_state==END-OF-MESSAGE; size>8000000; 
sasl_username=~/^\S+$/ action=FILTER smtp:[127.0.0.1]25;

main.cf:
smtpd_end_of_data_restrictions = check_policy_service inet:127.0.0.1:10040

This is meant to force any mail with size greater than 8MB to bypass the relay and go out directly, but it doesn't work - it uses the relay anyway.

I have tested it with different, simple criteria i.e. where the sasl_username 
is a specific testu...@example.com but no joy.

Postfwd is definitely running and listening on port 10040.

So my question is how can I get "check_policy_service" to override 
sender_dependent_relayhost_maps

Thank you,

Chris Robinson

Reply via email to