Mailing List Archive

Send mail via fallback interface
Hi

For situations where an IP is blocked or rate limited, we would like to
automatically try to send the mail via an alternate interface.

The following configuration achieves the desired result.
If a mail is queued for more than 5 minutes, it will be sent from a
different source IP.

remote_smtp:
  driver = smtp
  interface = ${if <{300}{${eval:$tod_epoch - $received_time}}{<; $FALLBACK_IPV4; $FALLBACK_IPV6}{<; $DEFAULT_IPV4; $DEFAULT_IPV6}}

While the mail can be sent on a second try, the retry database does not
reflect this:

Transport: mx1.host.net [123.123.123.123/NULL] error 60: Operation timed out
  first failed: 07-Mar-2024 12:01:28
  last tried:   07-Mar-2024 17:13:06
  next try at:  07-Mar-2024 18:43:06
Transport: mx2.host.net [123.123.123.124/NULL] error 60: Operation timed out
  first failed: 07-Mar-2024 12:01:06
  last tried:   07-Mar-2024 15:45:22
  next try at:  07-Mar-2024 17:15:22

After a while (past the final cutoff time), this causes mails to these
hosts to be bounced immediately (as documented).

Is there another way to retry sending mails from a different source
interface while maintaining correct retry db entries?

Kind regards,
Patrik
Re: Send mail via fallback interface [ In reply to ]
Trying to evade policy restrictions set by external sites is probably
a losing game, and liable to annoy them.

Perhaps, if your problem is a mix of bulk and not-bulk usage
(and it's the bulk ones resulting in these blocks) you could
pre-emptively use separate outbound IPs for the two classes?

I don't see a direct way to do what you are asking.
--
Cheers,
Jeremy


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Send mail via fallback interface [ In reply to ]
As this is the exim list I'll keep this part short, but what we do is
relay from our exim boxes out to ZoneMTA for the kind of behavior you
are wanting. To truly handle it properly you need proper context for
every bounce message and that means not only having a huge list of
errors to treat differently, but also being able to adapt as new ones
appear quite regularly. That kind of behavior is really not best handled
by hammering any particular configuration on top of exim, it would
ideally either be a very large and specific project for exim devs or
simply delegated to software that has a more directed focus on something
like that. I suspect the latter is always going to be the best path.

On 2024-03-07 11:10, Patrik Peng via Exim-users wrote:
> Hi
>
> For situations where an IP is blocked or rate limited, we would like to
> automatically try to send the mail via an alternate interface.
>
> The following configuration achieves the desired result.
> If a mail is queued for more than 5 minutes, it will be sent from a
> different source IP.
>
> remote_smtp:
>   driver = smtp
>   interface = ${if <{300}{${eval:$tod_epoch - $received_time}}{<;
> $FALLBACK_IPV4; $FALLBACK_IPV6}{<; $DEFAULT_IPV4; $DEFAULT_IPV6}}
>
> While the mail can be sent on a second try, the retry database does not
> reflect this:
>
> Transport: mx1.host.net [123.123.123.123/NULL] error 60: Operation
> timed out
>   first failed: 07-Mar-2024 12:01:28
>   last tried:   07-Mar-2024 17:13:06
>   next try at:  07-Mar-2024 18:43:06
> Transport: mx2.host.net [123.123.123.124/NULL] error 60: Operation
> timed out
>   first failed: 07-Mar-2024 12:01:06
>   last tried:   07-Mar-2024 15:45:22
>   next try at:  07-Mar-2024 17:15:22
>
> After a while (past the final cutoff time), this causes mails to these
> hosts to be bounced immediately (as documented).
>
> Is there another way to retry sending mails from a different source
> interface while maintaining correct retry db entries?
>
> Kind regards,
> Patrik

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Send mail via fallback interface [ In reply to ]
On Thu, 7 Mar 2024, Patrik Peng via Exim-users wrote:

> For situations where an IP is blocked or rate limited, we would like to
> automatically try to send the mail via an alternate interface.
>
> The following configuration achieves the desired result.
> If a mail is queued for more than 5 minutes, it will be sent from a different
> source IP.
>
> remote_smtp:
>   driver = smtp
>   interface = ${if <{300}{${eval:$tod_epoch - $received_time}}{<;
> $FALLBACK_IPV4; $FALLBACK_IPV6}{<; $DEFAULT_IPV4; $DEFAULT_IPV6}}
>
> While the mail can be sent on a second try, the retry database does not
> reflect this:
>
> Transport: mx1.host.net [123.123.123.123/NULL] error 60: Operation timed out
>   first failed: 07-Mar-2024 12:01:28
>   last tried:   07-Mar-2024 17:13:06
>   next try at:  07-Mar-2024 18:43:06
> Transport: mx2.host.net [123.123.123.124/NULL] error 60: Operation timed out
>   first failed: 07-Mar-2024 12:01:06
>   last tried:   07-Mar-2024 15:45:22
>   next try at:  07-Mar-2024 17:15:22
>
> After a while (past the final cutoff time), this causes mails to these hosts
> to be bounced immediately (as documented).
>
> Is there another way to retry sending mails from a different source interface
> while maintaining correct retry db entries?

I would try moving them to a seperate queue and sending to the "other"
interface from that queue.
I've no ide whether it would work or whether the queue
would need a seperate exim config, or could be run from
the existing config.

--
Andrew C. Aitchison Kendal, UK
andrew@aitchison.me.uk

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Send mail via fallback interface [ In reply to ]
Thanks all for the feedback

I agree that my approach may be a bit too creative,
I'll look into separate queues and corresponding outbound interfaces.

Kind regards,

Patrik Peng