[Exim] Flexible autoresponder in system filter

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Greg Ward
Fecha:  
A: exim-users
Asunto: [Exim] Flexible autoresponder in system filter
Hi all --

I'm trying to write a moderately flexible autoresponder in my system
filter, and keep running up against the cold, hard fact that there can
be multiple recipients, only one or two of which I really want to
autorespond to.

Here are the particulars: we run one mail server to handle the domains
mems-exchange.org and memsnet.org.  (And .com and .net versions, but
that's extraneous.)  For any incoming message to webmaster@ either
domain, I want to
  1) send a standard autoresponse (same basic text for both domains)
  2) send the message on to the suckers listed in the alias
     file under "webmaster" (our alias file is domain-neutral,
     so the same suckers get webmaster mail for both domains)


Here's what I've got in my system filter right now:

  if foranyaddress $recipients ($thisaddress begins "webmaster@") then 
    mail from $thisaddress 
         subject "Thank you for your e-mail" 
         expand file /etc/exim/webmaster_reply.txt 
         log mainlog 
  endif


The fact that $thisaddress expands in the "mail" command is a pleasant
and useful surprise, but it feels like a lucky implementation detail.
Is this something I can rely on? Or should I find another way to get
the "From" header right, where "right" means, "the autoresponse message
comes from the webmaster address that the user originally mailed to".

I want a similar effect in the body of the message; here's the first
paragraph from /etc/exim/webmaster_reply.txt:

Thank you for your message to $recipients.
This is an automated response; we do not respond manually to all e-mail sent
to this address.

$recipients doesn't work (it expands to "$recipients", which seems odd
-- I thought undefined variables expanded to the empty string).
Anyways, it would be ugly if the message had multiple recipients -- I do
NOT want something like

Thank you for your message to webmaster@???, gward@???

-- blechh. Obviously, what I want is the recipient address that caused
the "foranyaddress" test to succeed, which should be either
"webmaster@???" or "webmaster@???". None of the
following seem to work:
Thank you for your message to webmaster@$domain.
Thank you for your message to $thisaddress.
Thank you for your message to $original_local_part@$original_domain.
Thank you for your message to $parent_local_part@$parent_domain.

Anyone have a clue what I'm missing here?

Thanks --

        Greg
-- 
Greg Ward - software developer                gward@???
MEMS Exchange                            http://www.mems-exchange.org