[Cialug] can procmail...

Paul Gray gray at cs.uni.edu
Mon Apr 7 17:44:32 CDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matthew Nuzum wrote:
> I have a plugin called email2trac that checks email and automatically
> creates tickets in trac. I love it but twice now it's gotten into an
> infinite loop when some spammer sent the e-mail so that the to and
> from address were the same.
> 
> I'd like to add a measure of protection.
> 
> I was wondering if procmail can some how rewrite the from address if
> it matches something like support at domain.com. That way when email2trac
> grabs it, creates the ticket and auto replies there will be no danger
> of a loop.
> 
> Does anyone know how to do this? I'm not very experienced with procmail.
> 

It's relatively easy to avoid loops within procmail.  Just add an X-Loop
condition to its headers and drop it if you'd seen it already.

- -------------procmail snip----------
:0
* ^Subject:.*Something.*
/* ^From:.*Someone.* */
/* ... or any of a number of procmail matching criterion... */
* !^FROM_DAEMON  /* Make sure it doesn't match FROM_DAEMON */
* !X-Loop: loop at my.domain /* ...and that you haven't seen it before */
{

  :0 h c
  | (formail -r -I"Precedence: junk" \
  -A"X-Loop: loop at my.domain" ; /* This marks it as having been seen */ \
   /* Process commands here, or just pass it through */") \
  | $SENDMAIL -t

  :0
  $MAILHOME/test_drop_box /* Better to save a copy while testing */
}

:0
* X-Loop: loop at my.domain /* If it bears the scarlet letter */
/dev/null                /* drop the bits in the bucket */

- -------------endsnip----------------

- --
Paul Gray
314 East Gym, Dept. of Computer Science        -o)
University of Northern Iowa                    /\\
Supercomputing 2008 Education Program Chair   _\_V
Message void if penguin violated ...  Don't mess with the penguin
No one says, "Hey, I can't read that ASCII attachment ya sent me."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH+qPQOH45TZW7mh4RAkhXAJ9ohN3Gq6V9Purue31VcT7IwqUUTACcD6GJ
duVGUQN7uU7Fk+TCDKL8Y+E=
=LSgY
-----END PGP SIGNATURE-----


More information about the Cialug mailing list