Tag Archives: procmail

By Benreis (Own work) [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC-BY-3.0 (http://creativecommons.org/licenses/by/3.0)], via Wikimedia Commons

Vacation message using procmail

If you use procmail to filter messages, you can use it also to setup a vacation email response:

  1. Create a file called vacation.txt and fill it with your “vacation message”.
  2. Create a file called vacation.rc fill it with the following commands (and don’t forget to adjust the values for USER, DOMAIN, and PATHxxx to your needs):
:0 Whc: vacation.lock
* .*for <USER@DOMAIN>
* !^FROM_DAEMON
* !^X-Loop: USER@DOMAIN
| formail -rD 8192 vacation.cache
:0 ehc
| (formail -rA”Precedence: junk (autoreply)”
-A”X-Loop: USER@DOMAIN” ;
cat PATHTOVACATIONMESSAGE/vacation.txt
) | PATHTOSENDMAIL/sendmail -oi -t
  1. Find your .procmailrc file and add the following line after your filter commands (again adjust the PATH):
#INCLUDERC=PATHTORCFILE/vacation.rc

If you receive an email at USER@DOMAIN and it is not filtered out by your spam filter, the vacation commands are activated. It checks if the email is for you, does not originate from a mailing list, and has not been processed before. It also creates a file called vacation.cache, where it stores the email addresses to which a vacation message has already been sent, in order to do not send such a message again (don’t forget to delete it when you deactivate the vacation filter). At last it replies with the message stored in vacation.txt.

The “Precedence: junk (autoreply)” part helps to avoid bouncing messages from other MTAs.

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!