procmail
[Top] [All Lists]

Re: problem with alias

2006-05-12 10:49:34
At 16:04 2006-05-12 +0930, luke(_at_)chipcity(_dot_)com(_dot_)au wrote:
[snip - forwarding arrangement]

/etc/mail/aliases on mailserver1 shows
jobs:          employment

surely this should be
jobs:           employment(_at_)server2

since if the RHS lacks a domain, it'll try to deliver locally (although 
with userdb stuff, the MTA could rewrite it to deliver to a remote host - 
if that's what you're doing, you should mention it).

/etc/mail/aliases on mailserver2 shows
employment:        user1

If you don't actually need a local user for anything other than handling 
the autoreply, you could just invoke the procmail script (or your binary):

employment:     "|/usr/local/bin/procmail -m /etc/procmailrcs/somescript.rc"

or:

employment:     |/usr/local/foo/bin/progThatResponds

(though the program should deal with daemon and loop issues - as should the 
procmailrc script)

Then, you don't need user1 on the system at all.

The recipe for employment in the mentioned .procmailrc (on mailserver2) 
looks like this:

:0:
* ^TO_employment |/usr/local/foo/bin/progThatResponds

I suspect you've lost a newline in there between the condition and 
action.  Further, if the program you're pipine to is written properly, the 
recipe doesn't need a lockfile flag.  It it writes to a static datafile, it 
should do it's own locking, because you could invoke it from elsewhere 
(seeing as the path you're providing isn't local to the user, but rather 
global to the host).

Why isn't the mail to 'jobs(_at_)foo' processed correctly?

Because you're FORWARDING it, and the to/cc/bcc doesn't show the employment 
address.  a forward changes the envelope data on a message, but doesn't 
rewrite the visible headers.

As per the manpage, ^TO expands to:


(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-
        Envelope|Apparently(-Resent)?)-To):(.*[^a-zA-Z])?)


Examine the forwarded messages (as received by the second host) and see 
whether this expression would match.  When messages are directly addressed 
to that host, it's likely that the address appears in the To: header, and 
thus will match.

If the alias is just for that one address, there's not really a need to 
check for that address being a recipient -- checking for MAILER DAEMON and 
loops though would be a good idea, so you're not auto-replying to bounce 
messages.

---
  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
  Please DO NOT carbon me on list replies.  I'll get my copy from the list.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>