Hi!

For anyone possibly finding this thread while trying to figure out how to make 
OpenSMTPD work properly with Postfixadmin when using virtual mailboxes, here's 
how to do it.

As background info, when a mailbox is created using Postfixadmin, then 
Postfixadmin adds an entry to the alias table with identical entries in the 
address and goto columns.

In order to avoid an alias address expansion loop and correctly parse alias 
entries that point to 'real' (albeit virtual, in this case) mailboxes, the 
OpenSMTPD query_alias must be defined as follows:

query_alias SELECT IF(goto = address, 'vmail', goto) from alias WHERE address=?;

Note that in the above example, 'vmail' refers to which ever system user 
account is being used for storing the virtual e-mail boxes. In most HOWTO 
tutorials I've seen, the account 'vmail' is used.

The above query_alias works by comparing the contents of the goto and the 
address columns. If they match (meaning this row refers to a mailbox, not an 
alias), then 'vmail' is returned as the query result. Otherwise, the value of 
the goto column is returned instead.

Thank you Reio R. for pointing out that the issue had to do with "alias 
pointing to itself"!

- Jyri


Reply via email to