OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Query postfix for maildir

From: /dev/rob0 (rob0gmx.co.uk)
Date: Tue May 20 2008 - 11:15:42 CDT


On Tue May 20 2008 10:50:31 Mark O'Dell wrote:
> I have searched but can't find this anywhere, is there a command that
> will return the maildir(s) that a given address will deliver to?

That depends entirely on the delivery agent in use. Postfix delivery
agents local(8) and virtual(8) are different. For non-Postfix delivery
agents, see the documentation therefor.

Since you said "MySQL" I'll guess you might be using virtual(8). The
combined output of "postconf -h virtual_mailbox_base" and "postmap -q
userexample.com mysql:/path/to/your/virtual_mailbox_maps/query" would
do it.

> I have a folder with thousands of emails (it's a journal from another
> server) in it and I want to distribute them to the appropriate
> maildir based on the intended recipients. I have pretty much written

How did you determine the intended recipient?

> a PHP script that queries MySQL and find this information, but it
> seems to be a bit inefficient when Postfix already has the ability
> and is presumably faster than my PHP.

I wouldn't think so, at least not in any significant way.

> At the same time, possibly off topic, is there a better way of
> writing this email to the new maildir than using PHP?

Redirection?
--
    Offlist mail to this address is discarded unless
    "/dev/rob0" or "not-spam" is in Subject: header