Sending a new email with maildrop/mailbot
Larry Stone <[email protected]>
| Newsgroups | gmane.mail.maildrop |
|---|---|
| Message-ID | <[email protected]> |
I'm in the process of moving from procmail to maildrop* Anyway, one of the things I do is scan certain emails for a particular string and if found, extract that line and sent it to my phone's text message email address. A suitably munged procmail recipe to do this is: [email protected] :0BHc : * ^From:.*REDACTED.* * ^Subject:.*key subject * .*key text.* { MSGTEXT=`formail -I "" | grep -i "keytext"` :0 | (formail -brt -I 'From: [email protected]' \ -I 'Subject: Example' -I "To: [email protected]" ; \ echo $MSGTEXT) | /usr/sbin/sendmail -t } So far, for the Maildrop equivalent, I've come up with using mailbot (from reading the man page, it appears reformail is not the tool for this) is: if (/^From:.*REDACTED/ && \ /^Subject:.*key subject/ && \ /.*key text/:b && \ { `grep -i "key text" > .tmpmailfilter` cc "|/usr/local/bin/mailbot -t .tmpmailfilter \ -A 'From: [email protected]' \ -N -s "Key" /usr/sbin/sendmail -f '' [email protected]" `rm .tmpmailfilter` } This works so my only concern is that it is not optimal. Is there a way to avoid using the temporary file by using a variable like in the procmail recipe? Also, I tried setting the destination with [email protected] but if IIRC, correctly, that caused it to go to the original sender as well. Thanks in advance for any comments or suggestions. * Why the move? Unfortunately, the latest Mac OS X (10.9) has become more strict in strcpy error checking and procmail built under 10.9 will error on more complex recipes - currently using the procmail built under 10.8 but figure with no procmail development work in over 10 years, I may be living on borrowed time). -- Larry Stone [email protected] ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk