LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Procmail+Postfix vacation message issues (https://www.linuxquestions.org/questions/linux-software-2/procmail-postfix-vacation-message-issues-467774/)

fedora_user 07-26-2006 05:14 AM

Procmail+Postfix vacation message issues
 
Hi
I am trying to setup a vacation message using procmail with postfix. I have added the following script to .promailrc :

# Uncomment the lines below if you need log output for testing.
#
LOGFILE=/tmp/procmailvacation.log
VERBOSE=on

# vim: ft=procmail

# User-managed vacation recipe for procmail
# Written by Jason Thaxter
# (http://www.google.com/search?q=jason+thaxter)

# * Include this file in the procmail file.
# * Set $VACATION_PASSWORD. (for security, this is mandatory)
# * Define $VACATION_SENDER in your procmail recipe: it will be "from" this
# address.
# * E-mail a message with $VACATION_PASSWORD and $VACATION_ON in the subject
# line. The body of the message becomes the vacation message. $VACATION_ON
# can be set prior to the INCLUDERC, but it defaults to "vacation on".
# * To turn it off, e-mail a message with $VACATION_PASSWORD and $VACATION_OFF
# in the subject line. Likewise, $VACATION_OFF defaults to "vacation off".

# Note that you probably want this to execute *after* any mailing list or spam
# delivery recipes. You can set $VACATION_SKIP to disable vacation processing
# if it's inconvenient to skip this recipe.

# -----------------------------------------------------------------------------
# Configurable variables: These variables allow you to use this vacation recipe
# as an include and customize it from your main procmail file.
#
# lockfile:
VACATION_LOCK=$HOME/${VACATION_LOCK:-".vacation$LOCKEXT"}
# cache file:
VACATION_CACHE=$HOME/${VACATION_CACHE:-".vacation_cache"}
# cache size:
VACATION_CACHE_SZ=${VACATION_CACHE_SZ:-8192}
# message file
VACATION_MSG=$HOME/${VACATION_MSG:-".vacation_mesg"}
# what to use as the xloop header
HOSTNAME=${HOSTNAME:-`hostname`}
VACATION_XLOOP=${VACATION_XLOOP:-"$LOGNAME@$HOSTNAME"}
# base token for default $VACATION_ON and $VACATION_OFF
# so you could set this and not those individually
VACATION_COOKIE=${VACATION_COOKIE:-"vacation"}
VACATION_ON=${VACATION_ON:-"$VACATION_COOKIE on"}
VACATION_OFF=${VACATION_OFF:-"$VACATION_COOKIE off"}

#
#Change these variables
#
VACATION_PASSWORD=password
VACATION_DOMAIN_NAME=ccls.edu

VACATION_SENDER=$LOGNAME@$VACATION_DOMAIN_NAME
VACATION_SENDMAILFROM=${VACATION_SENDMAILFROM:-"-f$VACATION_SENDER"}
VACATION_SENDMAILFLAGS="-oi -t $VACATION_SENDMAILFROM"
# -----------------------------------------------------------------------------

SENDMAIL_CMD="$SENDMAIL $VACATION_SENDMAILFLAGS"
SHELL=/bin/sh

# check if we should send vacation message, add user to cache
:0 Whc: $VACATION_LOCK
# if i haven't been instructed to skip processing
* ? test -z $VACATION_SKIP
# if i have a vacation message file
* ? test -f $VACATION_MSG
# and the message is not from a daemon or mailer
* !^FROM_DAEMON
* !^FROM_MAILER
# not declared spam by spamassassin
* !^X-Spam-Flag: YES
# not discernably in a mailing list
* !^List-
* !^(Mailing-List|Approved-By|BestServHost|Resent-(Message-ID|Sender)):
* !^X-[^:]*-List:
* !^X-(Sent-To|(Listprocessor|Mailman)-Version):
# and not x-loop
* !^X-Loop: $VACATION_XLOOP
# add it to the cache
| formail -rD $VACATION_CACHE_SZ $VACATION_CACHE

:0 ehc
# if the name was not in the cache
# if we can find who we're sending it to
# and who we are sending this "From"
* ? test -n ${VACATION_MSG_SEND_TO}
* ? test -n ${VACATION_SENDER}
*$ !^From:.*$VACATION_SENDER
| (formail -r \
-I"Precedence: junk" \
-A"From: $VACATION_SENDER" \
-A"X-Loop: $VACATION_XLOOP"; \
cat $VACATION_MSG ) | \
$SENDMAIL_CMD

# Add/remove vacation message
:0
# First make sure that the sender has
# the correct username
* ^TO_\/[-\.a-z_]+@
*$ ^From:.*$\MATCH
# the correct email domain
*$ ^From:.*$\VACATION_DOMAIN_NAME
# only do this if we have a password set
* ? test -n $VACATION_PASSWORD
# and it's in the subject line
* $^Subject:.*${VACATION_PASSWORD}
{

# VACATION ON
# if subject line matches magic cookie for ON:
:0
* $^Subject:.*${VACATION_ON}
{
# pipe the body into the vacation message file
:0c:$VACATION_LOCK
| formail -I "" > $VACATION_MSG

# add message to the body
:0f
| cat - ; \
echo; \
echo '---------- VACATION -----------------'; \
echo 'The above text was installed as your vacation message'
}

# VACATION OFF
# if subject line matches magic cookie for OFF:
# delete the vacation file and notify
:0f
* $^Subject:.*${VACATION_OFF}
| cat -; \
echo '---------- VACATION -----------------'; \
echo 'Removing message and cache: '; \
rm -vf $VACATION_MSG; \
rm -vf $VACATION_CACHE; \
echo ; \
echo "Removed vacation message."

}


I am getting the following output from procmailvacation.log:

lost+found orbit-root procmailvacation.log
[root@puny tmp]# more procmailvacation.log
procmail: [19038] Wed Jul 26 10:06:04 2006
procmail: Assigning "VACATION_LOCK=/home/spamtest1/.vacation.lock"
procmail: Assigning "VACATION_CACHE=/home/spamtest1/.vacation_cache"
procmail: Assigning "VACATION_CACHE_SZ=8192"
procmail: Assigning "VACATION_MSG=/home/spamtest1/.vacation_mesg"
procmail: Executing "hostname"
procmail: Assigning "HOSTNAME=puny.ccls.edu"
procmail: Assigning "VACATION_XLOOP=spamtest1@puny.ccls.edu"
procmail: Assigning "VACATION_COOKIE=vacation"
procmail: Assigning "VACATION_ON=vacation on"
procmail: Assigning "VACATION_OFF=vacation off"
procmail: Assigning "VACATION_PASSWORD=password"
procmail: Assigning "VACATION_DOMAIN_NAME=ccls.edu"
procmail: Assigning "VACATION_SENDER=spamtest1@ccls.edu"
procmail: Assigning "VACATION_SENDMAILFROM=-fspamtest1@ccls.edu"
procmail: Assigning "VACATION_SENDMAILFLAGS=-oi -t -fspamtest1@ccls.edu"
procmail: Assigning "SENDMAIL_CMD=/usr/sbin/sendmail -oi -t -fspamtest1@ccls.edu"
procmail: Assigning "SHELL=/bin/sh"
procmail: Executing " test -z $VACATION_SKIP"
procmail: Match on " test -z $VACATION_SKIP"
procmail: Executing " test -f $VACATION_MSG"
procmail: Non-zero exitcode (1) from " test -f $VACATION_MSG"
procmail: No match on " test -f $VACATION_MSG"
procmail: No match on "(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)\/[-\.a-z_]+@"
procmail: Bypassed locking "/var/spool/mail/spamtest1.lock"
procmail: Assigning "LASTFOLDER=/var/spool/mail/spamtest1"
procmail: Opening "/var/spool/mail/spamtest1"
procmail: Acquiring kernel-lock
procmail: Notified comsat: "spamtest1@11487:/var/spool/mail/spamtest1"
From spamtest1@ccls.edu Wed Jul 26 10:06:03 2006
Subject: password vacation on
Folder: /var/spool/mail/spamtest1



Unfortunately I cannot see an obvious error, or perhaps that is because I dont know how to read them that well.

Any help will be much appreciated.

fedora_user 07-27-2006 03:54 AM

help please help

fedora_user 08-02-2006 08:54 AM

come on guys - please help me, iam desperate

fedora_user 08-04-2006 04:21 AM

procmail auto reply script not working-need help understanding log
 
if this post is in the wrong place can someone please tell me so i will go elsewhere.
If i smell please can someone tell so i can put in some nice smelling spray
If you know the answer to my problem please can you post it.
If you know but dont want to tell me please can you let me know.
If any other reason please let me know.

Thank you

fedora_user 08-07-2006 06:23 AM

need to setup vacatione message
 
Hi people

This is the second time iam trying to pursue an answer to my problem and I hope someone can help:
I need to setup auto-reply message for staff members when they are on leave. I wish for them to be able to set it up themselves and that they write out their own message.
My setup is postfix and procmail and spamassassin.
I hope someone can help, as i have been trying to resolve this for some weeks.

Regards and thank you in advance.

billymayday 08-07-2006 06:46 AM

Have you looked at vacation?

http://freshmeat.net/projects/vacation/

http://www.ayradyss.org/programs/current.html#vacation

fedora_user 08-07-2006 07:25 AM

Thanks for the reply, from what ive read it seems the sort of this that i need. But i dont think this will allow the individual Windows user to setup their own vacation message. Users do not have any access to shell.


All times are GMT -5. The time now is 09:04 AM.