Mailing List Archive

Delaying transport for a particular address
I could do with some help from the community. Our site runs a mailing list with alot of subscribers. At times it can put a strain on our system. What I would like to do is set up exim so that when emails arrive for a particular address, they are held until the night when it then does the delivery.

So I need to intercept mail for (let's say), list1@atm.ch.cam.ac.uk, delay transport until 12 midnight.

If someone could show me how to do this in the configure file I would be most grateful.

Thanks.

Glenn

--

Dr. Glenn Carver, Centre for Atmospheric Science, Univ. of Cambridge,
Chemistry Dept., Lensfield Road, Cambridge, CB2 1EW, UK.

mailto:Glenn.Carver@atm.ch.cam.ac.uk http://www.atm.ch.cam.ac.uk/~glenn/
Phone: +44 (1223) 763827 ** please note new numbers **
Fax: +44 (1223) 763823
Re: Delaying transport for a particular address [ In reply to ]
On Wed, 17 Jul 2002, Glenn Carver wrote:

> I could do with some help from the community. Our site runs a
> mailing list with alot of subscribers. At times it can put a strain
> on our system. What I would like to do is set up exim so that when
> emails arrive for a particular address, they are held until the
> night when it then does the delivery.
>
> So I need to intercept mail for (let's say),
> list1@atm.ch.cam.ac.uk, delay transport until 12 midnight.

it probably can be done in exim, too, which i'm lazy to look up; but
why not tell your list server not to run it's queue only at specified
times ? with mailman, it could probably be done with a little tweaking
of the qrunner script.

anyway, as for exim, i just got an idea; it may or may not work.

list_defer:
driver = smartuser
local_parts = list1
domains = whatever
condition = <some condition that is true or false based on current time>
[.or, actually, you could for example require_files = foo, where you
create and remove the file "foo" on a regular basis. there are
several other ways probably.]
new_address = :defer:


--
[-]
Re: Delaying transport for a particular address [ In reply to ]
On Wed, 17 Jul 2002, Glenn Carver wrote:

> So I need to intercept mail for (let's say), list1@atm.ch.cam.ac.uk, delay transport until 12 midnight.

Exim 4 FAQ -> keyword in context index -> D -> delayed -> Q9807.

(Actually, I see there's a bug in it. It should have allow_defer=true
set on it.)

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: Delaying transport for a particular address [ In reply to ]
Phil,

Thanks for your email. There's a typo in the exim 4 FAQ for Q9807 (as
well as the lack of allow_defer).

The condition line reads:

condition = ${if < ${$message_age}{86400}{yes}{no}}

and has an extra $ in front of message_age. It should be:

condition = ${if < {$message_age}{86400}{yes}{no}}

Just out of curiousity, suppose I wanted to defer a message based on
the time-of-day and only attempt delivery after 2am. I've seen the
$tod variables but I'd need a bit of regex to strip out and test just
the hour of the day. And I'm not a regex wiz.. how would I do it?

Thanks,
Glenn

On Wed, 17 Jul 2002, Glenn Carver wrote:

> So I need to intercept mail for (let's say),
>list1@atm.ch.cam.ac.uk, delay tra
nsport until 12 midnight.

Exim 4 FAQ -> keyword in context index -> D -> delayed -> Q9807.

(Actually, I see there's a bug in it. It should have allow_defer=true
set on it.)
Re: Delaying transport for a particular address [ In reply to ]
On Sat, 20 Jul 2002, Glenn Carver wrote:

> Thanks for your email. There's a typo in the exim 4 FAQ for Q9807 (as
> well as the lack of allow_defer).

Thanks. Both fixed in the newly released version.

> Just out of curiousity, suppose I wanted to defer a message based on
> the time-of-day and only attempt delivery after 2am. I've seen the
> $tod variables but I'd need a bit of regex to strip out and test just
> the hour of the day. And I'm not a regex wiz.. how would I do it?

${if match{$tod_log}{\N^.{11}(\d\d)\N}{$1}}

expands to the hour of the day. Thus, a condition that yields "yes"
between the hours of 2 am and 8 am is:

condition = ${if and \
{ \
{ > \
{${if match{$tod_log}{\N^.{11}(\d\d)\N}{$1}}} \
{2} \
} \
{ < \
{${if match{$tod_log}{\N^.{11}(\d\d)\N}{$1}}} \
{8} \
} \
} \
{yes}{no}}



--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: Delaying transport for a particular address [ In reply to ]
Hmm.. still not sure I've got this delayed mail working correctly. With the FAQ router in place it seems that exim is actually temporarily rejecting email from the sending server. Whereas what I want it to do is accept the message and queue it for a deferred delivery.

Here's the log file entry:

16:34:16 H=plum.csi.cam.ac.uk [131.111.8.3] F=<user@met.reading.ac.uk> temporarily rejected RCPT <user-local@atm.ch.cam.ac.uk>: delivery delayed

My configure router looks like this:

delay:
driver = redirect
domains = atm.ch.cam.ac.uk
local_parts = user-local
condition = ${if < {$message_age}{43200} {yes}{no}}
data = :defer: delivery delayed
allow_defer = true

When I tested this using -bt (admittedly as a local user) it seemed to work ok. What have I missed??

Thanks,
Glenn



On 2002.07.22 10:29 Philip Hazel wrote:
> On Sat, 20 Jul 2002, Glenn Carver wrote:
>
> > Thanks for your email. There's a typo in the exim 4 FAQ for Q9807 (as
> > well as the lack of allow_defer).
>
> Thanks. Both fixed in the newly released version.
>
> > Just out of curiousity, suppose I wanted to defer a message based on
> > the time-of-day and only attempt delivery after 2am. I've seen the
> > $tod variables but I'd need a bit of regex to strip out and test just
> > the hour of the day. And I'm not a regex wiz.. how would I do it?
>
> ${if match{$tod_log}{\N^.{11}(\d\d)\N}{$1}}
>
> expands to the hour of the day. Thus, a condition that yields "yes"
> between the hours of 2 am and 8 am is:
>
> condition = ${if and \
> { \
> { > \
> {${if match{$tod_log}{\N^.{11}(\d\d)\N}{$1}}} \
> {2} \
> } \
> { < \
> {${if match{$tod_log}{\N^.{11}(\d\d)\N}{$1}}} \
> {8} \
> } \
> } \
> {yes}{no}}
>
>
>
> --
> Philip Hazel University of Cambridge Computing Service,
> ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
>
>
--

Dr. Glenn Carver, Centre for Atmospheric Science, Univ. of Cambridge,
Chemistry Dept., Lensfield Road, Cambridge, CB2 1EW, UK.

mailto:Glenn.Carver@atm.ch.cam.ac.uk http://www.atm.ch.cam.ac.uk/~glenn/
Phone: +44 (1223) 763827 ** please note new numbers **
Fax: +44 (1223) 763823
Re: Delaying transport for a particular address [ In reply to ]
On Mon, 22 Jul 2002, Glenn Carver wrote:

> Hmm.. still not sure I've got this delayed mail working correctly.
With the FAQ router in place it seems that exim is actually temporarily
rejecting email from the sending server. Whereas what I want it to do is
accept the message and queue it for a deferred delivery.


Put no_verify on the router.

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.