From: Jonathan Cutting on
Hello fellow Postfix users,

I am attempting to configure a postfix server for multiple domains,
which will use a milter to send an email to a mailarchiving store
(mailarchiva). What I would like to do is:

Match the originating domain in outbound mail using a hash table or sql
lookup and use a specific milter depending on domain

Match the to: address in incoming mail to similarly choose a milter
based on domain

The reason is that I should like each company(domain) to have its own
mailarchiving store containing only their own emails, and I would like
to run multiple instances of the mailarchiving software on another
server distinguished from each other by port number.

I guess some sort of domain:port_number mapping would suffice. Is this
possible using milters or might it be easier to use a custom script?

I would be most grateful for any help on this, I haven't found a surfeit
of information online as yet.

Thanks,

Jon

From: Noel Jones on
On 1/28/2010 1:46 AM, Jonathan Cutting wrote:
> Hello fellow Postfix users,
>
> I am attempting to configure a postfix server for multiple domains,
> which will use a milter to send an email to a mailarchiving store
> (mailarchiva). What I would like to do is:
>
> Match the originating domain in outbound mail using a hash table or sql
> lookup and use a specific milter depending on domain
>
> Match the to: address in incoming mail to similarly choose a milter
> based on domain

Not possible. Postfix must connect to the milter before it
knows the recipient.

>
> The reason is that I should like each company(domain) to have its own
> mailarchiving store containing only their own emails, and I would like
> to run multiple instances of the mailarchiving software on another
> server distinguished from each other by port number.
>
> I guess some sort of domain:port_number mapping would suffice. Is this
> possible using milters or might it be easier to use a custom script?

A single milter that handles all domains is what you need. Or
maybe a "master" milter that can connect to multiple secondary
milters based on the recipient.

Or easiest would be to use MX records to send mail for each
domain to its own postfix instance.


-- Noel Jones

From: Jose-Marcio Martins da Cruz on
Noel Jones wrote:
> On 1/28/2010 1:46 AM, Jonathan Cutting wrote:

>>
>> I guess some sort of domain:port_number mapping would suffice. Is this
>> possible using milters or might it be easier to use a custom script?
>
> A single milter that handles all domains is what you need. Or maybe a
> "master" milter that can connect to multiple secondary milters based on
> the recipient.
>
> Or easiest would be to use MX records to send mail for each domain to
> its own postfix instance.

Another reason to do it this way (multiple MXs and multiple instances of postfix) is that a single
message can be sent to many recipients in different domains hosted by your mailserver.


--

From: Wietse Venema on
Noel Jones:
> On 1/28/2010 1:46 AM, Jonathan Cutting wrote:
> > Hello fellow Postfix users,
> >
> > I am attempting to configure a postfix server for multiple domains,
> > which will use a milter to send an email to a mailarchiving store
> > (mailarchiva). What I would like to do is:
> >
> > Match the originating domain in outbound mail using a hash table or sql
> > lookup and use a specific milter depending on domain
> >
> > Match the to: address in incoming mail to similarly choose a milter
> > based on domain
>
> Not possible. Postfix must connect to the milter before it
> knows the recipient.

I can confirm this. Milters expect to see the complete SMTP session.

Switching milters in the middle of a session wasn't really anticipated
in the Milter architecture. In fact, the Sendmail Milter library
will return an error if SMTP protocol elements arrive out of order.

Wietse

From: Jonathan Cutting on
Thanks to everyone who responded on this. I've never tried running
multiple postfix instances on the same machine but it would certainly
solve the problem very neatly indeed.

I have a spam/av server ahead of the postfix machine so I can specify
the port and IP address without too much trouble based on recipient, I'm
not clear on how else I'd choose the correct instance but will
investigate. Thanks again

Jon


On 28/01/10 13:37, Noel Jones wrote:
> On 1/28/2010 1:46 AM, Jonathan Cutting wrote:
>> Hello fellow Postfix users,
>>
>> I am attempting to configure a postfix server for multiple domains,
>> which will use a milter to send an email to a mailarchiving store
>> (mailarchiva). What I would like to do is:
>>
>> Match the originating domain in outbound mail using a hash table or sql
>> lookup and use a specific milter depending on domain
>>
>> Match the to: address in incoming mail to similarly choose a milter
>> based on domain
>
> Not possible. Postfix must connect to the milter before it knows the
> recipient.
>
>>
>> The reason is that I should like each company(domain) to have its own
>> mailarchiving store containing only their own emails, and I would like
>> to run multiple instances of the mailarchiving software on another
>> server distinguished from each other by port number.
>>
>> I guess some sort of domain:port_number mapping would suffice. Is this
>> possible using milters or might it be easier to use a custom script?
>
> A single milter that handles all domains is what you need. Or maybe a
> "master" milter that can connect to multiple secondary milters based
> on the recipient.
>
> Or easiest would be to use MX records to send mail for each domain to
> its own postfix instance.
>
>
> -- Noel Jones