Koozali.org: home of the SME Server

Vacation Message usage

Offline smeghead

  • *
  • 563
  • +0/-0
Vacation Message usage
« on: June 30, 2010, 04:36:18 PM »
Hi all

I just ran into a small issue when setting up a vacation message for a client.

I tend to test a variety of messages, layouts, wording. links, etc until a client is happy.  With this process it means I run several test emails to the account with vacation message enabled, often several within an hour.

Now the vacation message setup is designed to only send the reply if any of the following conditions are met (from the vacation man page):

       -      The sender address includes the string -REQUEST@.
       -      The sender is you.
       -      The sender's name is any of:
                    daemon
                    postmaster
                    mailer-daemon
                    mailer
                    root
       -      The sender matches any of the mail addresses listed in the optional files ~/.vacation.aliases and
              ~/.vacation.noreply.
       -      There is a Precedence: bulk or Precedence: junk header.
       -      There is a Mailing-List: header.
       -      Your mail address, or any address you have listed in the optional ~/.vacation.aliases file does not appear
              in either the To: or Cc: headers.
       -      An automatic reply has already been sent to the same address during the last week. The timeout value
              may be changed using the -t option.

Now this last item stops me from doing the testing I need so here is how to change this behaviour if you so choose.

The vacation message stuff, once enabled for a user, is driven via that users .qmail file, for example:

| /usr/local/bin/vacation -j <account name>
| /usr/bin/procmail ~/.procmailrc ; if [ $? -ne 0 ] ; then exit -1; else exit 99; fi;
./Maildir/

where <account name> is the account for which the vacation message has been enabled.

Now to allow me to do my thing I need to tell the messaging system to allow more frequent sending of the vacation messages, fortunately (by good design) there is a command line switch that allows for this, namely -t.

Now -t accepts a duration value, so if I want the system to send the message after only a 5 second delay it would be -t5s, an 8 hour delay, -t8h, etc

So how to add it to the system ...

We need to modify the templates that write out the .qmail file, the ones we're interested in are:

/etc/e-smith/templates-user/.qmail/49vacationMessage
/etc/e-smith/templates-user/.qmail/74vacationMessage

Now we can edit these templates or copy them to templates-user-custom & edit the copies leaving the originals pristine, a lot better option IMHO, and the SME way.

.. now for some commands to get this done

mkdir /etc/e-smith/templates-user-custom/.qmail
cp /etc/e-smith/templates-user/.qmail/49vacationMessage /etc/e-smith/templates-user-custom/.qmail/49vacationMessage
cp /etc/e-smith/templates-user/.qmail/74vacationMessage /etc/e-smith/templates-user-custom/.qmail/74vacationMessage
cd /etc/e-smith/templates-user-custom/.qmail

If we edit the templates in /etc/e-smith/templates-user-custom/.qmail (I use Midnight Commander, mc -d) we'll notice that each of them has this line:

      return "| /usr/local/bin/vacation -j $VacationDelay $USERNAME"

so we need to change this line to add the delay value, for 8 hours we would change the line to:

      return "| /usr/local/bin/vacation -j -t8h $VacationDelay $USERNAME"

Once these changes are made to both files the new option is global for all users when the vacation message is enabled; if a user currently has the message enabled you'll need to disable & then re-enable the message to get their .qmail file rewritten.

While I was in test mode I set it to 5 seconds, once finished I left it at 24 hours for this client.

Enjoy.

BTW - once peeps have had a chance to comment & critique I can write this up in the wiki
..................

Offline axessit

  • *****
  • 213
  • +0/-0
Re: Vacation Message usage
« Reply #1 on: June 30, 2010, 04:58:40 PM »
from http://www.dungog.net/wiki/Smeserver-vacation you can set db prop values. Change on the fly by changing the prop values and signal-event qmail-update.

Seems much simpler to me...

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Vacation Message usage
« Reply #2 on: June 30, 2010, 05:47:17 PM »
I just ran into a small issue when setting up a vacation message for a client.

Off-topic for this forum, which concerns only software installed from the SME server CDROM. There is no vacation message feature of the standard SME server software.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Vacation Message usage
« Reply #3 on: June 30, 2010, 05:56:27 PM »
Moving to SME 7.x Contribs as it is more appropriate there.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)