Operations grimoire/Legacy archive/Mail server notes

From Nasqueron Agora

This document is historical. We adopted Dovecot, Postfix and ViMbAdmin for mail server.

IMAP and POP servers

courier-authlib

To use courier-authlib against vpopmail MySQL authentication:

/usr/local/etc/authlib/authmysqlrc
MYSQL_SERVER            localhost
MYSQL_USERNAME          ...
MYSQL_PASSWORD          ...
MYSQL_PORT              0
MYSQL_OPT               0
MYSQL_DATABASE          vpopmail
MYSQL_USER_TABLE        vpopmail
MYSQL_CRYPT_PWFIELD pw_passwd
MYSQL_UID_FIELD     1189
MYSQL_GID_FIELD     1189
MYSQL_LOGIN_FIELD   CONCAT(pw_name, '@', pw_domain)
MYSQL_HOME_FIELD    pw_dir
MYSQL_NAME_FIELD    pw_gecos

Utilities

qmail-autoresponder

If invoked from vpopmail instead vmailmgr, it doesn't contain From: header.

/usr/ports/mail/qmail-autoresponder/files/patch-main.c — Autoresponder used only error-way (e.g. catchall)
diff --git main.c main.c
index ba1a0b9..5de20cc 100644
--- main.c
+++ main.c
@@ -475,6 +475,9 @@ int main(int argc, char* argv[])
     out = &bufout;
   }

+  //TODO: create a mailer-daemon@domain.tld finder
+  //For example: read /var/qmail/control/me, and prepend by mailer-daemon@
+  obuf_put3s(out, "From: Mail Delivery Subsystem <mailer-daemon@", "grip.espace-win.org", ">\n");
   obuf_put3s(out, "To: <", sender, ">\n");
   if(opt_subject_prefix)
     obuf_put4s(out, "Subject: ", opt_subject_prefix, subject.s, "\n");
/usr/ports/mail/qmail-autoresponder/files/patch-main.c — Target account used as From
(patch to write)

Installation tips:

To grant minimal privileges to a qmailresponder MySQL account
GRANT SELECT,DELETE,INSERT ON vpopmail.response TO 'qmailresponder'@'localhost' IDENTIFIED BY '...';
GRANT SELECT ON vpopmail.autoresponder TO 'qmailresponder'@'localhost';
Add to my.cnf
[qmail-autoresponder]
# Public account to see the currently set responders.
user=qmailresponder
password=...
database=vpopmail