Quantcast

Write a personalized header

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Write a personalized header

luistkd4


Hi, I have the transport_maps with hash to specify where serve messages will be redirect.
Can I save in header a result of the query in transport_maps each mail ?

Example:

1) A client mail sent a mail(thunderbird)
2) My postfix will autentic with Active Directory
3) After mail go to a transport_map where mail will be sent

Before the step 3, exist a way to postfix consult a memcacached server based in user and the result write in header like: 

The user [hidden email] try to send message and the postfix consult memcached and have the follow result:

[hidden email] ---> mailserver01.dominio.com

I want write this result "mailserver01.dominio.com" in the header.

Can postfix do it? 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Write a personalized header

Viktor Dukhovni

> On Apr 25, 2017, at 10:49 AM, Luis Miguel Flores dos Santos <[hidden email]> wrote:
>
> Hi, I have the transport_maps with hash to specify where serve messages will be redirect.
> Can I save in header a result of the query in transport_maps each mail ?

No.  The Postfix queue file is becomes effectively read-only after the message is
received, but transport lookup happens later as mail is delivered.

The header can't be added until delivery time, because multi-recipient messages
will send different recipients via different transports.

> I want write this result "mailserver01.dominio.com" in the header.
>
> Can postfix do it?

Mostly no.  If you just need this for a very small set of relays, you could
use a dedicated smtp(8) transport for each one, and in the master.cf entry
for each specify an override for "smtp_header_checks" with a suitable
REPLACE or PREPEND action for some place-holder header that you prepend on
message receipt.

        /^X-Relayed-TBD:/ REPLACE X-Relayed-To: smtp1.example.com

while in the default smtp(8) transport for other destinations:

        /^X-Relayed-TBD:/ IGNORE

This is rather complex, and the relay name will be in the "Received"
header added by the receiving system, so it is rather unclear why you'd
want to go to all the trouble.  My advice is to not do this.

--
        Viktor.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Write a personalized header

luistkd4

Thanks a lot Viktor!

I wanted to make this to segment the wich server the message will be delivered because I have the problem:

Today I have 10 mail server and I have created a proxy for the domain to coexist between them. And create a postfix to clients connect and send message (Previous mail)

But now when the message is arrived by the Postfix (called msa-proxy) it just check the user in active directory and send the message.

All mail server have a virtual-mta to delivery mail with 3 ips.
When a users send message via email client(msa-proxy) all the 10 servers will be sent message with just 3 IPs and the queue increases

Like you tell: "This is rather complex" I'm sure ?


De: [hidden email] <[hidden email]> em nome de Viktor Dukhovni <[hidden email]>
Enviado: terça-feira, 25 de abril de 2017 12:48:06
Para: Postfix users
Assunto: Re: Write a personalized header
 

> On Apr 25, 2017, at 10:49 AM, Luis Miguel Flores dos Santos <[hidden email]> wrote:
>
> Hi, I have the transport_maps with hash to specify where serve messages will be redirect.
> Can I save in header a result of the query in transport_maps each mail ?

No.  The Postfix queue file is becomes effectively read-only after the message is
received, but transport lookup happens later as mail is delivered.

The header can't be added until delivery time, because multi-recipient messages
will send different recipients via different transports.

> I want write this result "mailserver01.dominio.com" in the header.
>
> Can postfix do it?

Mostly no.  If you just need this for a very small set of relays, you could
use a dedicated smtp(8) transport for each one, and in the master.cf entry
for each specify an override for "smtp_header_checks" with a suitable
REPLACE or PREPEND action for some place-holder header that you prepend on
message receipt.

        /^X-Relayed-TBD:/ REPLACE X-Relayed-To: smtp1.example.com

while in the default smtp(8) transport for other destinations:

        /^X-Relayed-TBD:/ IGNORE

This is rather complex, and the relay name will be in the "Received"
header added by the receiving system, so it is rather unclear why you'd
want to go to all the trouble.  My advice is to not do this.

--
        Viktor.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Write a personalized header

luistkd4

Victor can I use  "Postfix After-Queue Content Filter" to insert new header based in a query ?


De: [hidden email] <[hidden email]> em nome de Luis Miguel Flores dos Santos <[hidden email]>
Enviado: terça-feira, 25 de abril de 2017 13:33:39
Para: Postfix users
Assunto: Re: Write a personalized header
 

Thanks a lot Viktor!

I wanted to make this to segment the wich server the message will be delivered because I have the problem:

Today I have 10 mail server and I have created a proxy for the domain to coexist between them. And create a postfix to clients connect and send message (Previous mail)

But now when the message is arrived by the Postfix (called msa-proxy) it just check the user in active directory and send the message.

All mail server have a virtual-mta to delivery mail with 3 ips.
When a users send message via email client(msa-proxy) all the 10 servers will be sent message with just 3 IPs and the queue increases

Like you tell: "This is rather complex" I'm sure ?


De: [hidden email] <[hidden email]> em nome de Viktor Dukhovni <[hidden email]>
Enviado: terça-feira, 25 de abril de 2017 12:48:06
Para: Postfix users
Assunto: Re: Write a personalized header
 

> On Apr 25, 2017, at 10:49 AM, Luis Miguel Flores dos Santos <[hidden email]> wrote:
>
> Hi, I have the transport_maps with hash to specify where serve messages will be redirect.
> Can I save in header a result of the query in transport_maps each mail ?

No.  The Postfix queue file is becomes effectively read-only after the message is
received, but transport lookup happens later as mail is delivered.

The header can't be added until delivery time, because multi-recipient messages
will send different recipients via different transports.

> I want write this result "mailserver01.dominio.com" in the header.
>
> Can postfix do it?

Mostly no.  If you just need this for a very small set of relays, you could
use a dedicated smtp(8) transport for each one, and in the master.cf entry
for each specify an override for "smtp_header_checks" with a suitable
REPLACE or PREPEND action for some place-holder header that you prepend on
message receipt.

        /^X-Relayed-TBD:/ REPLACE X-Relayed-To: smtp1.example.com

while in the default smtp(8) transport for other destinations:

        /^X-Relayed-TBD:/ IGNORE

This is rather complex, and the relay name will be in the "Received"
header added by the receiving system, so it is rather unclear why you'd
want to go to all the trouble.  My advice is to not do this.

--
        Viktor.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Write a personalized header

Viktor Dukhovni

> On Apr 25, 2017, at 1:35 PM, Luis Miguel Flores dos Santos <[hidden email]> wrote:
>
> Victor can I use  "Postfix After-Queue Content Filter" to insert new header based in a query ?

Wrong question.  You should not have to do this at all.  Why do you have
a proxy that cannot do mail routing between Postfix and the downstream MTAs?

The right solution is deliver directly from Postfix to the intended destination.

> Today I have 10 mail server and I have created a proxy for the domain to coexist between them. And create a postfix to clients connect and send message (Previous mail)

What is the purpose of the proxy.  Given that your English is poor, a longer description of the requirements will likely make more sense than a short one which will lose a lot in translation.

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Write a personalized header

luistkd4

Sorry my English is very poor.

I'll try describe it better now:

I have 10 mail server and 9 are smartermail an 1 exchange, and same domains can exist in each one but don't mail account. An example I have a domain EXAMPLE.COM created in two plataforms:

[hidden email] --> smartermail01.dominio.com
[hidden email] --> exchange.dominio.com

Exchange and smartermail check the MX,  delivery message across my outgoing server, [hidden email] can send a mail to [hidden email].

When a message will be delivered by my outgoing server using web, I have a pattern list based in header where message was created ( smartermail01.dominio.com or exchange.dominio.com). Based in this
pattern I decide what ip will deliver the message.

msa-proxy:
So, when a user acess via thunderbird your smtp record is the same for users in smartermail01.dominio.com and exchange.dominio.com (smtp.dominio.com).
The postfix check the user and pass in AD and send the message to my outgoing server. 
But the message don't cross the smartermail or exchange now, and I don't know where the user because doesn't have the information in the header now. 

For this I want write a header where user are created(smartermail or exchange) for can use a pattern list to delivery messages in the same IP when I delivery a message like web


De: [hidden email] <[hidden email]> em nome de Viktor Dukhovni <[hidden email]>
Enviado: terça-feira, 25 de abril de 2017 14:49:07
Para: Postfix users
Assunto: Re: Write a personalized header
 

> On Apr 25, 2017, at 1:35 PM, Luis Miguel Flores dos Santos <[hidden email]> wrote:
>
> Victor can I use  "Postfix After-Queue Content Filter" to insert new header based in a query ?

Wrong question.  You should not have to do this at all.  Why do you have
a proxy that cannot do mail routing between Postfix and the downstream MTAs?

The right solution is deliver directly from Postfix to the intended destination.

> Today I have 10 mail server and I have created a proxy for the domain to coexist between them. And create a postfix to clients connect and send message (Previous mail)

What is the purpose of the proxy.  Given that your English is poor, a longer description of the requirements will likely make more sense than a short one which will lose a lot in translation.

--
        Viktor.

Loading...