Hello,
Well, whilst I have now got the idea of what I wanted sorted out, trying to
achieve it proved a little harder than I expected. To handle unknown users I
now have the following transport/director:
unknown_user: (transport; the same as before)
driver = pipe
command = "TABLES/messages/unknown-user.sh"
ignore_status
return_output
timeout = 10m
user = exim
unknownuser: (director)
no_expn
no_verify
debug_print = "In unknown dir, reply is $reply_address, return is
$sender_address\n"
transport = unknown_user
driver = smartuser
new_address="${if and {{match {$reply_address} \
{(?i)@plymouth\\\\.ac\\\\.uk\\$}} \
{! match {$h_precedence:} {(?i)junk|bulk|list}}} \
{$reply_address} {$sender_address}}"
Basically the 'new_address' says that if the $reply_address is a known local
address (which will have @plymouth.ac.uk on the end), and its not from a
list then use the $reply_address (i.e. the Resent-from: or From: header).
Otherwise use the sender address.
I ran exim with -d9 and captured the output to a file. I manually entered
the addresses and all the headers from a known message which had gone to the
wrong user before (which was the start of all this!).
The message went from user 'jhorne@???' to 'sroberts@???'.
They then forwarded (using the forward button) to unknown user
'buster@???'. The failure message should go back to sroberts, but
it doesn't - it goes to jhorne. With header (not envelope) rewriting
jhorne=>j.horne and sroberts=>s.roberts. The envelope rewriting causes
jhorne=>jhorne@??? and
sroberts=>sroberts@???.
The captured output file shows:
calling unknownuser director
In unknown dir, reply is s.roberts@???, return is
j.horne@???
unknownuser director called for buster@???
This looks good. The director is called, the $reply_address is s.roberts and
the $sender_address is j.horne.
generated new address: sroberts@???
queued for unknown_user transport: local_part=sroberts
domain=csuf11.csd.plym.ac.uk
unknownuser director succeeded for buster
>>>>>>>>>>>>>>>>>>>>>>>>
After directing:
Local addresses:
buster@???
Again this looks good. The new address has been correctly determined (i.e.
send the message back to sroberts rather than jhorne), queues it for the
transport with the right local_part and domain.
However, it doesn't go there! It goes back to user jhorne (me actually) and
I can't see why. It all looks okay, but it just doesn't seem to do it (which
probably means I've done something wrong).
Any ideas as to what is going on, why I get the failure message rather than
sroberts despite what exim says.
Thanks,
John.
--------------------------------------------------------------------------
John Horne, University of Plymouth, UK Tel: +44 (0)1752 233914
E-mail: jhorne@???
Finger for PGP key: john@???