Lessons Learned From a Fight With Procmail

What should have been a simple procmail autoreply:

:0hc
* ^TO_hfugal\+cs110
* ^Subject: *lab +[0-9]+ +submission
| (formail -rt -I"Reply-To: hfugal+cs110@cs.nmsu.edu"; \
   echo "Submission Received") | $SENDMAIL -t

became a morning-long wrestling match. I made a few mistakes (forgot to escape the + in the first condition), but mostly it was utter stubbornness on th epart of SunOS. So here are the lessons I learned:

  • Use VERBOSE=yes from the very beginning.
  • LOG=`formail -v` and the like makes for a great debugging trick when you don’t have shell access.
  • SunOS mail 5.10 Generic_125100-10 sun4v sparc SUNW,Sun-Fire-T1000 doesn’t have formail.
  • Even if you build formail and put it in your PATH, it doesn’t seem to work (but ! hans@example.com does, so sending mail from that box should work)
  • It’s easier to just forward it to a more friendly email server and do the heavy lifting there.

So on the Solaris server:

:0c
* ^TO_hfugal\+cs110
* ^Subject: *lab +[0-9]+ +submission
! hans@fugal.net

On my own sane Linux server:

:0h
* ^TO_hfugal\+cs110
| (formail -rt -I'Reply-To: hfugal+cs110@cs.nmsu.edu'; \
   echo "Submission Received") | $SENDMAIL -t

Leave a Reply