On Fri, Jan 08, 2010 at 02:33:37PM -0500, Christopher Hackman wrote: > Is it possible to customize the following error message? > > MAIL FROM: <u...@remotedomain.com> > 250 2.1.0 Ok > RCPT TO: <invalidacco...@virtualdomain.com> > 550 5.1.1 <invalidacco...@virtualdomain.com>: Recipient address > rejected: virtualdomain.com > > In this sanitized example, "virtualdomain.com" is just that, as is > "invalidaccount". I see "unknown_virtual_mailbox_reject_code" will > let me change the response code, but not the text.
Right. A fairly straightforward (not simple, but doable) workaround is to implement a check_recipient_access lookup against your list of valid addresses. Your virtual_mailbox_maps query will not work as is, but a little bit of SQL/LDAP magic or a simple policy service could do it. Pseudocode: if domain matches virtual_mailbox_domains: if u...@domain is found in virtual_mailbox_maps: return DUNNO else: return 550 5.1.1 <u...@domain> Your-custom-reject-text endif endif (repeat for other address classes in use) Perhaps one of the existing publically available policy servers can already do this, I don't know. Is this really worth the trouble? I would think not, but if you still want to do it, check out these references: Access controls: http://www.postfix.org/SMTPD_ACCESS_README.html http://www.postfix.org/access.5.html SQL or LDAP interaction: http://www.postfix.org/MYSQL_README.html http://www.postfix.org/mysql_table.5.html http://www.postfix.org/PGSQL_README.html http://www.postfix.org/pgsql_table.5.html http://www.postfix.org/LDAP_README.html http://www.postfix.org/ldap_table.5.html Policy service protocol: http://www.postfix.org/SMTPD_POLICY_README.html and see this for links to existing policy server projects: http://www.postfix.org/addon.html#policy -- Offlist mail to this address is discarded unless "/dev/rob0" or "not-spam" is in Subject: header