Re: [exim] Manipulating the Date Header on message delivery

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: David S. Madole
Dátum:  
Címzett: Exim Users Mailing List
CC: Ray Jackson
Tárgy: Re: [exim] Manipulating the Date Header on message delivery
From: "Ray Jackson" <ray@???>
> Maybe if I could rephrase the question to be: "Is it possible to get

Exim to
> execute a command (based on a filter i.e. where recipient contains xyz)

either
> during delivery (to alter the email content - such as the Date header)

or
> alternatively execute a command after delivering the email into the

user's
> Inbox. I can easily write a quick Perl script to rewrite the Date
> header in 10
> minutes, but can Exim initiate external commands like this at delivery

time?

Yes, the "${perl", "${run", "${readsocket", and "${readfile" expansion
items are all useful for this sort of thing:

http://www.exim.org/exim-html-4.40/doc/html/spec_11.html#SECT11.4

You could do this in a system filter with the "headers add" and "headers
remove" commands:

http://www.exim.org/exim-html-4.40/doc/html/spec_40.html#SECT40.6

Or you could do it in the transport with the "headers_add" and
"headers_remove" options:

http://www.exim.org/exim-html-4.40/doc/html/spec_24.html#CHAP24

Finally, just to demonstrate that anything is possible in exim, here is a
string expansion you could use to create a new date header without
calling an external program. You can factor any sort of time offset into
this near the end by changing the "5*3600" (which is five hours worth of
seconds):

# exim -be 'Date:
${expand:${sg{\N${extract{${eval:TOD/86400-TOD/86400/7*7+1}} { } {Wed Thu
Fri Sat Sun Mon Tue}},
${substr_1_2:${eval:(TOD/86400-(TOD/86400*100+75)/36525*36525/100)-((((TO
D/86400-(TOD/86400*100+75)/36525*36525/100)*10+5)/306)*306+5)/10+101}}
${extract{${eval:(((TOD/86400-(TOD/86400*100+75)/36525*36525/100)*10+5)/3
06)+1}} { } {Mar Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb}}
${eval:(TOD/86400*100+75)/36525+1972+(((TOD/86400-(TOD/86400*100+75)/3652
5*36525/100)*10+5)/306)/10}
${substr_1_2:${eval:TOD/3600-TOD/86400*24+100}}:${substr_1_2:${eval:TOD/6
0-TOD/3600*60+100}}:${substr_1_2:${eval:TOD-TOD/60*60+100}}\N}{TOD}{${eva
l:$tod_epoch-86400*790-5*3600}}}} -0500'
Date: Sat, 09 Oct 2004 09:11:56 -0500
#

This expansion could be simplified quite a bit using macros, of course.

David