Re: How To Rewrite "Mail From:"?

2020-07-07 Thread Matus UHLAR - fantomas

On Mon, Jul 06, 2020 at 07:40:27PM +, Drew Tomlinson wrote:

I use postfix for my own domain and have been forwarding my email to
outlook.com for years.  Recently, email has just been disappearing
between my server and my inbox so I set it to forward my email to
gmail.com.  Shortly after, I saw some messages like these in the logs:


You're running into intentional breakage caused by SPF and DMARC.
Sadly, this means that (simple) mail forwarding no longer works
reliably.


In reading Google documentation, I learned SPF is failing.  Further
reading revealed this is a common problem with forwarded email since
it is not being sent by an authorized IP address.  Other articles
suggested the workaround for this is to change the "Mail From:" to
reflect my domain since I have SPF configured for it.  And maybe this
is what is meant by SRS (Sender Rewriting Scheme)?


On 06.07.20 15:53, Viktor Dukhovni wrote:

Even changing the envelope sender is not enough.  With DMARC you
need to also change the "From:" header in the message.


only if content changes, OR a DMARC mail passes SPF but not DKIM,
(iirc) 


This should make it a bit easier to be DMARC compliand by implementing SRS
(forwarding that keeps SPF working).

Domains that configure DMARC but not DKIM (are there such?) are of course in
trouble when their mail is forwarded this way.


The simplest thing to do is to encapsulate the original message
as attachment to a new message.


yes, this should work too.

--
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
He who laughs last thinks slowest.


Re: rewrite all but one address

2020-07-07 Thread Wietse Venema
Paul Littlefield:
> Hello,
> 
> How would I rewrite all emails from one domain to another domain,
> apart from a single address, so that the messages are sent on to
> an external mail relay by default?
> 
> e.g.
> 
> @test.com > @example.com > smtp:relay
> joe.blo...@test.com > delivered locally

Rewrite the address to itself (this is how recursion stops).

> Is this canonical (http://www.postfix.org/canonical.5.html) ?

(I'd use virtual_alias_maps, because canonical maps can change 
message headers which may not be needed).

Wietse


rewrite all but one address

2020-07-07 Thread Paul Littlefield

Hello,

How would I rewrite all emails from one domain to another domain, apart from a 
single address, so that the messages are sent on to an external mail relay by 
default?

e.g.

@test.com > @example.com > smtp:relay
joe.blo...@test.com > delivered locally

Is this canonical (http://www.postfix.org/canonical.5.html) ?

Thanks,

Paul



Re: content_filter with external script and virtual_alias_maps

2020-07-07 Thread Stats Student
On Fri, Jul 3, 2020 at 3:44 AM Matus UHLAR - fantomas  wrote:
>
> >> Stats Student:
> >> > 1) in addition to sending the messages to a script, is there a way to
> >> > store the messages in a real mailstore ( Maildir ) ?
>
> >On Wed, Jul 1, 2020 at 8:31 AM Wietse Venema  wrote:
> >> Add a recipient with virtual_alias_maps, sender_bcc_maps,
> >> recipient_bcc_maps, etc., and use the existing local(8) or virtual(8)
> >> delivery agent to deliver to a maildir.
>
> On 01.07.20 13:34, Stats Student wrote:
> >As for your other suggestion, I am sorry I didn't follow what you
> >recommended specifically.
>
> you can alias the recipient to two destinations, where one sends mail to
> script, other delivers it to mail store.
>
> you can do this in virtual alias table, alias table, in .forward file etc.
>
> Note that with alias table or .forward, failure to deliver to the script can
> result in multiple delivery.
>
> --
> Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
> Warning: I wish NOT to receive e-mail advertising to this address.
> Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
> Enter any 12-digit prime number to continue.

Thank you, but I still do not understand why I need to provide
additional user aliases. If my system receives a message for
us...@example.com, that message needs to go to two places - 1) the
script and 2) Maildir mailstore. I don't want that message to now get
addressed to user2@, user3@, etc, the same way that one can have
messages addressed to root be aliased to real users - root: user1,
user2, etc. Maybe I am not understanding aliases correctly.

If anything, I would think the solution would be to add another
virtual_transport, or maybe even a transport_map (which I did look
into but couldn't see how to make it work for my problem). Maybe my
use case is very unusual and I should just enhance my script to save
messages in separate files (they'll be used to enhance the parser, not
be read by users), but I am hoping I can avoid that.


Re: content_filter with external script and virtual_alias_maps

2020-07-07 Thread Wietse Venema
Stats Student:
> Thank you, but I still do not understand why I need to provide
> additional user aliases. If my system receives a message for

To deliver a message to two destinations 

1) a script
2) a maildir file

That message needs to have (surprise!) two destinations.

1) a destination that delivers to the script
2) a destination that delivers to the maildir file

You can add that second destination with virtual_alias_maps,
sender_bcc_maps, recipient_bcc_maps, .forward files, and so on.

Wietse



Re: content_filter with external script and virtual_alias_maps

2020-07-07 Thread Stats Student
On Tue, Jul 7, 2020 at 2:15 PM Wietse Venema  wrote:
>
> Stats Student:
> > Thank you, but I still do not understand why I need to provide
> > additional user aliases. If my system receives a message for
>
> To deliver a message to two destinations
>
> 1) a script
> 2) a maildir file
>
> That message needs to have (surprise!) two destinations.
>
> 1) a destination that delivers to the script
> 2) a destination that delivers to the maildir file
>
> You can add that second destination with virtual_alias_maps,
> sender_bcc_maps, recipient_bcc_maps, .forward files, and so on.
>
> Wietse
>
Could you please show an example of what would go into one of those
maps to indicate a maildir destination?

us...@example.com 


Re: content_filter with external script and virtual_alias_maps

2020-07-07 Thread Wietse Venema
Stats Student:
> On Tue, Jul 7, 2020 at 2:15 PM Wietse Venema  wrote:
> >
> > Stats Student:
> > > Thank you, but I still do not understand why I need to provide
> > > additional user aliases. If my system receives a message for
> >
> > To deliver a message to two destinations
> >
> > 1) a script
> > 2) a maildir file
> >
> > That message needs to have (surprise!) two destinations.
> >
> > 1) a destination that delivers to the script
> > 2) a destination that delivers to the maildir file
> >
> > You can add that second destination with virtual_alias_maps,
> > sender_bcc_maps, recipient_bcc_maps, .forward files, and so on.
> >
> > Wietse
> >
> Could you please show an example of what would go into one of those
> maps to indicate a maildir destination?

Prerequisites:
foo@example delivers to script
bar@example delivers to maildir

Use virtual_alias_maps with:
foo@example foo@example, bar@example

Now, mail for foo@example goes to script and maildir.

How to deliver to script or maildir? Use transport_maps to select
a delivery agent that delivers to script (local or pipe delivery
agent) or maildir (virtual or local delivery agent).

foo@example 


Re: content_filter with external script and virtual_alias_maps

2020-07-07 Thread Stats Student
On Tue, Jul 7, 2020 at 4:19 PM Wietse Venema  wrote:
>
> Stats Student:
> > On Tue, Jul 7, 2020 at 2:15 PM Wietse Venema  wrote:
> > >
> > > Stats Student:
> > > > Thank you, but I still do not understand why I need to provide
> > > > additional user aliases. If my system receives a message for
> > >
> > > To deliver a message to two destinations
> > >
> > > 1) a script
> > > 2) a maildir file
> > >
> > > That message needs to have (surprise!) two destinations.
> > >
> > > 1) a destination that delivers to the script
> > > 2) a destination that delivers to the maildir file
> > >
> > > You can add that second destination with virtual_alias_maps,
> > > sender_bcc_maps, recipient_bcc_maps, .forward files, and so on.
> > >
> > > Wietse
> > >
> > Could you please show an example of what would go into one of those
> > maps to indicate a maildir destination?
>
> Prerequisites:
> foo@example delivers to script
> bar@example delivers to maildir
>
> Use virtual_alias_maps with:
> foo@example foo@example, bar@example
>
> Now, mail for foo@example goes to script and maildir.
>
> How to deliver to script or maildir? Use transport_maps to select
> a delivery agent that delivers to script (local or pipe delivery
> agent) or maildir (virtual or local delivery agent).
>
> foo@example

Sorry if I am not explaining the requirement correctly.

I need the same message addressed to f...@example.com to be delivered
to *two* places - the script AND the mailstore, *not* two different
accounts.
I do *not* want messages addressed to f...@example.com to also go to
b...@example.com which is what the virtual_alias_maps you showed would
do.

Re: transport maps -- my understanding is that those work on a per
domain basis. Don't think I want to have a separate transport for each
user.