| Home | Documentation | Mailinglist | Download | License |
check_user - lookup existing recipients (users) in a database
Enable user-level validation of addresses so that qpsmtpd can readily bounce invalid messages at the smtp level.
It does this by looking up the recipient address resp. user and host part of the email address in a database.
The inspiration of this module comes from a mailer setup with qpsmtpd and exim, where exim is used to manage virtual accounts in a database as described on http://flakey.info/mailserver/ or http://www.xmn-berlin.de/~marte/exim/exim4.conf.php
In the main configuration file the line
check_user must be placed
before the line
rcpt_ok, because it returns only DENY, DECLINED or
DENYSOFT but never OK.
After changing the configuration in /etc/qpsmtpd/check_user, qpsmtpd must be restartet, because the connection to the database and the preparing of the SQL statements takes place on startup. The connection to the database server is hold open resp. uses auto reconnect (MySQL).
On errors in /etc/qpsmtpd/check_user, missing database connection etc. qpsmtpd won't start.
All following entries must be present:
check_userwhich database fields to use for the lookup in the table email_table.
If the field email_address is given, email_user and email_domain are ignored and vice versa.
check_userwhich database field to use for the lookup in the table domain_table.
An example should make this clear. Given recipient address: 'firstname.lastname@example.org':
email_address lookup 'email@example.com' in email_table 1) resp. email_user lookup 'user' in email_table 2) email_domain lookup 'domain.de' in email_table 2) and domain_domain lookup 'domain.de' in domain_table 1) ignored, if email_user and email_domain defined in config 2) ignored, if email_address defined in config
The resulting SQL queries are:
SELECT count(*) AS `success` FROM `$email_table` WHERE `$firstname.lastname@example.org'; resp. SELECT count(*) AS `success` FROM `$email_table` WHERE `$email_user`='user' AND `$email_domain`='domain.de'; and SELECT count(*) AS `success` FROM `$domain_table` WHERE `$domain_domain`='domain.de';
The result values are the same as for qpsmtpd plugins:
"4xx Internal error - try later"response.
This will happen on errors, e.g.: The database server went down after start of qpsmtpd.
"5xx Address '...@...' doesn't exist on this server"response.
The message will be denied, if the domain is one of ours, but the user can't be found.
Following lines could be found in the log using debug logging:
Local address '...@...' if the email address belongs to a virtual user of our domain(s) Foreign address '...@...' if the email address is not in our domain(s)
The message will be passed on to the next plugin, e.g. rcpt_to, which will decide whether relaying is allowed or not.
This module is only tested with mysql for DBI. Feel free to try other drivers - please tell me about your experience.
check_user requires the Perl modules Data::Dumper, DBI and the choosen driver.
None known yet (however, see limitations above).
Thanks to Ask Bjoern Hansen for qpsmtpd.
(c) Ernesto 2007, email@example.com
Last updated 27 August 2007.
As per the qpsmtpd license.