Tony van der Hoff wrote: > I have a squeezy VPS, running Postfix to handle all my mail, plus > several virtual users, with which I'm entirely satisfied. Please consider upgrading from oldstable Squeeze 6 to the current stable Wheezy 7. > So far, so good, but what I'd really like to do is intercept the > incoming email on the VPS, and automatically run a script to do the update. This is probably quite easy in total. In the parts it will require a little bit of knowledge of postfix, procmail, dns and some scripting to tie everything together. > Does anyone know how to attach some sort of filter/trigger to postfix to > cause a script to be run on incoming mail with particular conditions, > or would anyone like to suggest a better solution? The default upstream mailbox_command command is empty and Postfix will deliver mail itself. But Debian by default sets it to procmail. Please verify your command setting. The easiest is with: # postconf mailbox_command mailbox_command = procmail -a "$EXTENSION" If it says the above then it is set to procmail. Otherwise it will say what it is set to and that is what it will do. If it is not set to procmail but is empty then you can still route messages through procmail using a $HOME/.forward file. This is the original legacy way of doing it. "|IFS=' ';exec /usr/bin/procmail || exit 75 #uniqueusernamehere" Either will cause mail delivery to be piped through procmail. You can then use procmail to intercept email according to rules you set. Normally you would say only intercept and filter just this IP camera emails by something unique to the email headers. I will just say in general terms since there are many HOWTOs and documents about procmail. But procmail would typically be used to separate out the email messages and then pipe them through a script that you would write. Perhaps something like this: :0w:serialize.lock * ^From: mycamera@example.com * ^Subject: New IP address | script-to-handle-camera-ip-change This script would be handed the email from procmail as standard input. The script would do the extraction of the IP address from the mail. Then the script would call your nsupdate command to update your dns. The contents of the script will depend upon the way the mail is sent to you from the camera and other things. But hopefully this will be enough hints to say how to get from an email message to a script to interpret it and act upon it. Bob
Attachment:
signature.asc
Description: Digital signature