# Problems with Procmail auto replies



## usdmatt (Sep 19, 2014)

Don't know if there's any Procmail experts on here but I'm banging my head against a wall here.
I've been using the following .procmailrc configuration for a long time to send out-of-office replies.


```
MY_EMAIL=me@mydomain.com
:0 Whc: vacation.lock
* !^FROM_DAEMON
* !^X-Loop: $MY_EMAIL
| /usr/local/bin/formail -rD 8192 vacation.cache
:0 ehc
| (/usr/local/bin/formail -rA"Precedence: bulk" -A"X-Loop: $MY_EMAIL"; cat $HOME/vacation.msg) | /usr/sbin/sendmail -f$MY_EMAIL -oi -t
```

It appears that this is no longer working. It's possible it happened during a version upgrade of the server, possibly from the 8 to 9 series. I don't use the facility much so I'm not sure exactly when it stopped. I've put debug mode on and get the following in the log:


```
procmail: [93548] Fri Sep 19 11:32:13 2014
procmail: Assigning "MY_EMAIL=me@mydomain.com"
procmail: Match on ! "(^(Mailing-List:|Precedence:.*(junk|bulk|list)|To: Multiple recipients of |(((Resent-)?(From|Sender)|X-Envelope-From):|>?From )([^>]*[^(.%@a-z0-9])?(Post(ma?(st(e?r)?|n)|office)|(send)?Mail(er)?|daemon|m(mdf|ajordomo)|n?uucp|LIST(SERV|proc)|NETSERV|o(wner|ps)|r(e(quest|sponse)|oot)|b(ounce|bs\.smtp)|echo|mirror|s(erv(ices?|er)|mtp(error)?|ystem)|A(dmin(istrator)?|MMGR|utoanswer))(([^).!:a-z0-9][-_a-z0-9]*)?[%@>     ][^<)]*(\(.*\).*)?)?$([^>]|$)))"
procmail: Match on ! "^X-Loop: $MY_EMAIL"
procmail: Locking "vacation.lock"
procmail: Executing "/usr/local/bin/formail,-rD,8192,vacation.cache"
procmail: Non-zero exitcode (1) from "/usr/local/bin/formail"
procmail: Assigning "LASTFOLDER=/usr/local/bin/formail -rD 8192 vacation.cache"
procmail: Unlocking "vacation.lock"
procmail: Assigning "LASTFOLDER= (/usr/local/bin/formail -rA"Precedence: bulk" -A"X-Loop: $MY_EMAIL"; cat $HOME/vacation.msg) | /usr/sbin/sendmail -f$MY_EMAIL -oi -t"
procmail: Executing " (/usr/local/bin/formail -rA"Precedence: bulk" -A"X-Loop: $MY_EMAIL"; cat $HOME/vacation.msg) | /usr/sbin/sendmail -f$MY_EMAIL -oi -t"
procmail: Assigning "LASTFOLDER=/mail/home/matt/mail/new/1411122733.93548_1.mail-a"
procmail: Notified comsat: "matt@0:/mail/home/matt/mail/new/1411122733.93548_1.mail-a"
From me@senderdomain.com  Fri Sep 19 11:32:13 2014
 Subject: last test...
  Folder: /mail/home/matt/mail/new/1411122733.93548_1.mail-a     9301
```

The first recipe runs and creates the vacation.cache. It also appears to run the second recipe, which calls `formail` & `sendmail` to send the reply, but nothing goes out. I see no record of the email being sent in /var/log/maillog.

If I cat the email message, /mail/home/matt/mail/new/1411122733.93548_1.mail-a..., and pipe it into the command listed in the Procmail log, (the command it says it is executing), it sends the email out successfully.

I'm a bit stuck now. I'm no Procmail expert (this was cobbled together from examples years ago). As far as the Procmail log is concerned, it appears to think it has run the right command to send the reply, but Sendmail logs show nothing. I'm not even sure how to debug this any further.


----------



## usdmatt (Sep 19, 2014)

OK, so after a few hours of messing around and finally resorting to the forums, I've come across an obvious error that led me to fix it.
Found the following in /var/log/messages


```
mail-a nologin: Attempted login by matt on UNKNOWN
```

On this server all the users have /sbin/nologin for shell as they don't require any sort of access to the server. Looks like this was stopping Procmail from being able to run commands as the user. (although it did manage to create the vacation.cache file...)

Changing to /bin/sh fixed it.


----------

