5

Let's say I don't set up relayhost because I want by default to send all the emails by the server itself.

Then for some domains in the "FROM", I want to relay to a specific relay. For that I would use a sender_dependent_relayhost_maps = hash:/etc/postfix/relay_by_sender and inside it, I would put something like:

@mydomain.com         ses.amazon.com

That is all very straight forward.


Now, what do I put in "relay_by_sender" file to say that I want all my emails relayed for my domain, but one in particular. How would I do that? E.g

@mydomain.com           ses.amazon.com
[email protected]   null?

Thanks

2 Answers 2

7

In Postfix 2.6 or later, I guess you can return the keyword DUNNO, which is documented in sender_dependent_relayhost_maps topic.

[email protected]   DUNNO
@mydomain.com           ses.amazon.com

If it doesn't work and you use Postfix 2.7 or newer, I suggest you to replace sender_dependent_relayhost_maps with sender_dependent_default_transport_maps. The latter provides more flexibility:

# /etc/postfix/main.cf
sender_dependent_default_transport_maps = hash:/etc/postfix/relay_by_sender

# /etc/postfix/relay_by_sender
[email protected]   smtp
@mydomain.com           smtp:[ses.amazon.com]
1
  • Thanks. I don't know how I missed the big DUNNO in the doc after that many readings... I need a break I guess :) Commented Apr 13, 2016 at 20:26
0

I'm not sure to understand if you want to use the default transport (send by the server itself) for a specific mail address, or completely deny relaying for this particular sender address.

If you want to use the default transport, @anderson-medeiros-gomes's solution seems appropriate.

If you want to deny relaying for this mail, you may also use the special error: mailer documented in the manpage of transport:

       The error mailer can be used to bounce mail:

            .example.com     error:mail for *.example.com is not deliverable

In your case would give for /etc/postfix/relay_by_sender:

[email protected]   error:Relaying not allowed for no-relay address
@mydomain.com           ses.amazon.com

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .