Qmail Autoresponder

Installation

 $ make
 # ./installer
 # ./instshow
 # vi /etc/vmailmgr/vdeliver-postdeliver

And make sure it contains:

 #!/bin/sh
 if test -s $MAILDIR/autoresponse/message.txt
 then
   qmail-autoresponder $MAILDIR/autoresponse/message.txt $MAILDIR/autoresponse
 fi

Then

 # /etc/vmailmgr/vdeliver-predeliver

and make sure it contains:

 #!/bin/sh
 /usr/local/bin/vcheckquota

Then

 # chmod a+x /etc/vmailmgr/*

Usage

Put

 |qmail-autoresponder MESSAGE_FILE DIRECTORY

into your

 .qmail

file before other delivery instructions. MESSAGE_FILE is a pre-formatted response, including headers, and DIRECTORY is the directory into which rate-limiting information will be stored. Any instance of “%S” in MESSAGE_FILE will be replaced with the original subject.

Follow these instructions from the vautoresponder file:

  1. set MAILDIR to the (virtual) user’s mail directory
  2. create a directory “autoresponse” within the user’s mail directory
  3. create a file “message.txt” within the users autoresponse directory

How to make cvm work on OpenBSD?

Bruce Guenter’s cvm librairies use Linux style sockets. That is usually fine on OpenBSD, except that the cvm_udp code opens a socket, and then uses sendto() which implicitly reoppens the socket. OpenBSD doesn’t like that, so here is the patch to fix cvm-0.18:

--- client.c.org        Fri Feb 20 12:07:55 2004
+++ client.c    Fri Feb 20 12:09:26 2004

This patch allows cvm to run on BSD.  Under Linux,
one can open a socket, and then use sendto which
technically reopens the socket.  Under BSD, it isn't
allowed to use sendto() with a socket that is
already open.

@@ -269,9 +269,8 @@
   if ((he = gethostbyname(hostname)) == 0) return 1;
   memcpy(&ip, he->h_addr_list[0], 4);

-  if ((sock = socket_udp()) == -1) return CVME_IO;
-  if ( !socket_connect4(sock, &ip, port) ||
-      !udp_sendrecv(sock, &ip, port)) {
+  if ((sock = socket_udp()) == -1) return CVME_IO;
+  if (!udp_sendrecv(sock, &ip, port)) {
     close(sock);
     return CVME_IO;
   }