On 5/7/2016 2:18 PM, Viktor Dukhovni wrote:
> 
>> On May 7, 2016, at 8:31 AM, Wietse Venema <wie...@porcupine.org> wrote:
>>
>>> What I'm currently trying to get working is a service entry in master.cf
>>> that has its own header checks conf file. This service would only be
>>> used for specific sender addresses in order to limit the header removal
>>> to just those email notifications generated by Google Calendar.
>>
>> Postfix can't do this on the receiving end, but you can do it on the
>> delivering end.
> 
> Well, Postfix can do this on the sending end via:
> 
>     main.cf:
>       # Resolve sieve auto-forwarder sender address to "autosieve" transport
>       sender_dependent_default_transport_maps = ...
>       autosieve_header_checks = pcre:${config_directory}/autosieve.pcre
> 
>     master.cf:
>       autosieve unix ... smtp
>           -o smtp_header_checks=$autosieve_header_checks
> 
>     autosieve.pcre:
>       /^Auto-Submitted:/      IGNORE
> 
>     
> http://www.postfix.org/postconf.5.html#sender_dependent_default_transport_maps
>     
> http://www.postfix.org/postconf.5.html#empty_address_default_transport_maps_lookup_key
>     http://www.postfix.org/postconf.5.html#smtp_header_checks
> 
> Log inspection will reveal what envelope sender address sieve notices
> are sent by.
> 
> However, dropping "Auto-Submitted:" headers rather risks mail loops
> and need to be done with great care, if at all.  The OP needs to
> be quite sure that he's not generating an email in response to email
> that is a response to a previously generated email ...
> 
> So, in general don't do this.  In specific cases, only after careful
> analysis of the resulting mail flow making sure that the Sieve rule
> can never fire in response to any message that might come back as
> a result of the generated and no longer manifestly "Auto-Submitted"
> notice.
> 
> Read RFC 3834 with care.
> 

Hi Viktor,

Thank you for the detailed reply. Would the following be correct?

# master.cf (two lines)
autosieve      unix  -       -       -       -       -       smtp
  -o smtp_header_checks=$autosieve_header_checks

# main.cf (two lines)
sender_dependent_default_transport_maps =
hash:${config_directory}/sender_dependent_default_transport_maps.conf
autosieve_header_checks = pcre:${config_directory}/autosieve.pcre

# sender_dependent_default_transport_maps.conf
#
# This entry is matching against gmail.com because Google Calendar
# delivers notifications to your associated Gmail account. To
# receive them on your outside email account you have to configure
# Gmail to forward email. When it does, the Calendar notification
# appears to end up with an envelope sender address of your
# Gmail account. For testing purposes, I am attempting to just
# match on ALL Gmail accounts.
@gmail.com             autosieve

After not getting any results, I went back an added a test Gmail account
and sent from there to my primary account. No entries in the mail log
any different from a standard delivery. I went back and modified the
master.cf entry like so:

# master.cf (three lines)
autosieve      unix  -       -       -       -       -       smtp
  -o syslog_name=postfix/autosieve
  -o smtp_header_checks=$autosieve_header_checks

At this point I suspect I missed something obvious.

I have the postconf -n and postconf -Mf output ready to post if you
don't spot my mistake above.

Thanks for your help.

Reply via email to