1

i need launch a script when receive an email with specific subject, i've try fetchmail + procmail, this my configuration

.fetchmailrc

set no bouncemail defaults: antispam -1 batchlimit 100 poll imap.googlemail.com protocol IMAP auth password user "[email protected]" is root here password 'xxxxx' ssl mda "/usr/bin/procmail -f %F -d %T"; 

.procmailrc

PATH=/bin:/usr/bin:/usr/local/bin:$HOME/bin:/usr/sbin MAILDIR=/var/mail LOGFILE=/var/log/procmail.log :0 * ^Subject: "Test OK" | echo "Test" >> /var/log/test.log 

When send mail with subject Test OK, i see in procmail log the lines:

From [email protected] Sat Dec 8 18:41:16 2018 Subject: Test OK Folder: /var/mail/root 5304 

But no execute the echo, any ideas? Thanks

1
  • Does your personal .procmailrc really have the privileges to write to /var/log/procmail.log? This seems like a misconfiguration, either way. Commented Dec 8, 2018 at 20:29

1 Answer 1

1

The Subject line in the log message doesn't have double quotes around it; hence, your regex didn't match.

A better test is probably to save the entire message to a particular folder.

Perhaps see also Procmail degugging tips

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.