On Thursday 27 October 2011 20:59:47 Fred Kilbourn wrote:
> I have a virtual mailbox environment and mailboxes are mapped into
> postfix from mysql with the following map:
>
> virtual_mailbox_maps =
> proxy:mysql:.../mysql_virtual_mailbox_maps.cf
>
> The map queries the database as such:
>
> SELECT maildir FROM mailbox WHERE username='%s' AND active = '1'
>
> Right now, when a user is disabled (by setting active = 0), the
> mailbox is not given to postfix and a 5.1.1 / unknown user in
> virtual mailbox table rejection occurs. Can someone help or point
> me in the right direction to figure out how to check for these
> disabled boxes and instead send a 4.2.1 or 5.2.1 mailbox disabled
> reply instead?
Remove the "AND active = '1'" condition from the virtual_mailbox_maps
query. Add check_recipient_access to smtpd_recipient_restrictions to
return the lookup address where active is 0. Something like:
main.cf ::
smtpd_recipient_restrictions = [ ... ] reject_unauth_destination,
check_recipient_access mysql:/path/to/disabled-user-query[,
... ]
/path/to/disabled-user-query ::
query = SELECT username FROM mailbox WHERE username='%s'
AND active = '0'
result_format = 'reject %s Mailbox disabled'
Look up the appropriate SMTP code in RFC 5321, and DSN in RFC 3463 if
desired. I think it would be '550 5.2.1 %s Mailbox disabled'.
--
Offlist mail to this address is discarded unless
"/dev/rob0" or "not-spam" is in Subject: header