Sunday, July 18, 2004

Setting up Subversion
Steps to add a new command to run on receiving an email to an address:

  1. Add to /etc/smrsh as a symlink - programs in here will be run by sendmail
  2. Check the permissions on the file that this links to - mail must be able to stat it
  3. Add the alias to /etc/aliases eg.:
  4. sariel "|sarial-mailgw"
  5. Run "newaliases"

My python program consists of something like the following:

#!/usr/bin/python
import time

t = int(time.time())
f = open("/tmp/sariel.%d"%(t), 'w')
f.write("sariel %d\n"%(t))
f.close()

So, you can then test sending a mail to the program -

echo hello | mail -s "test" sariel@localhost

And a new file should appear in /tmp

If nothing happens, look for returned mail in your own mailbox (mail) or check /var/log/maillog for error messages.