OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Get mail message headers via pipe transport

From: mouss (usebsdfree.fr)
Date: Thu Dec 01 2005 - 19:35:44 CST


Webmaster Elaconta.com a écrit :
> I've sucessfully built a virtual Postfix email server which reads the
> users logins and passwords, quota limits, etc, from a database (Postfix
> really excels at this kind of thing).
> Users can now manage their domains on their own through a Web-interface.
> I've just built a script to enable autoresponders (yes i know
> autoresponders suck but some clients just want them and that's it) which
> follow the configuration of Postfix in the manner discussed at:
>
> http://www.postfix.org/VIRTUAL_README.html#autoreplies
>
> It works great. Thing is, I would like to know which measures can i take
> to detect mailing lists so an autoreply (say a vacation message or
> something) is never sent to a mailing list. I've googled for it, and
> came up with the following:

Look at RFC 3834.

>
> - Don't send autoreplies to emails with an envelope sender that begins
> with "owner-"

as well as "request-*", "*-request*", "*-owner*" ....

> - Look for a "Precedence" header in the email, if it's set to "bulk",
> "list" ou "junk" then don't send autoreplies to it.
>

- don't respond to bounces, spam and viruses
- don't respond if the rcpt isn't in To/CC/Resent-TO/Resent-CC headers
- don't respond to an auto-response (or to any automatically generated
   mail unless that is part of your auto-responder job)
- ...

> The thing is, as i'm using the following layout:
>
> /etc/postfix/master.cf:
> # =============================================================
> # service type private unpriv chroot wakeup maxproc command
> # (yes) (yes) (yes) (never) (100)
> # =============================================================
> autoreply unix - n n - - pipe
> flags= user=nobody argv=/path/to/autoreply $sender $mailbox
> my autoreply script only gets access to the sender email address and the
> mailbox (which is the recipient email address, as i'm using virtual). Is
> there any way to pass along the email headers to the script so it could
> check the "Precedence" header?

you get the whole mail.

now, reinventing the wheel is a risky thing. why not use the vacation
program?