Rewrite From header from old to new style

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Rewrite From header from old to new style

Dominic Raferd
I would like to rewrite an old-style header in a locally-generated
mail (say by cron under Ubuntu 19.04 and earlier) e.g.
From: [hidden email] (Cron Daemon)

to the new-style header e.g.
From: Cron Daemon <[hidden email]>

It must be done before milters so that it can be signed by opendkim
milter after the header rewrite. canonical looks like the right tool
but the examples I have seen only show it working on an address not
the full header text.

I am using postfix 3.3. Apart from cron, the only other local source
of such old-style headers that I can find is postfix itself:
e.g. From: [hidden email] (Mail Delivery System)
- maybe more recent postfix releases use the new style?
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite From header from old to new style

Jaroslaw Rafa
Dnia 22.10.2019 o godz. 15:55:45 Dominic Raferd pisze:
> It must be done before milters so that it can be signed by opendkim
> milter after the header rewrite.

I think it's just enough to do it in the very first milter, isn't it?
--
Regards,
   Jaroslaw Rafa
   [hidden email]
--
"In a million years, when kids go to school, they're gonna know: once there
was a Hushpuppy, and she lived with her daddy in the Bathtub."
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite From header from old to new style

Noel Jones-2
In reply to this post by Dominic Raferd
On 10/22/2019 9:55 AM, Dominic Raferd wrote:

> I would like to rewrite an old-style header in a locally-generated
> mail (say by cron under Ubuntu 19.04 and earlier) e.g.
> From: [hidden email] (Cron Daemon)
>
> to the new-style header e.g.
> From: Cron Daemon <[hidden email]>
>
> It must be done before milters so that it can be signed by opendkim
> milter after the header rewrite. canonical looks like the right tool
> but the examples I have seen only show it working on an address not
> the full header text.
>
> I am using postfix 3.3. Apart from cron, the only other local source
> of such old-style headers that I can find is postfix itself:
> e.g. From: [hidden email] (Mail Delivery System)
> - maybe more recent postfix releases use the new style?
>


http://www.postfix.org/postconf.5.html#header_from_format



   -- Noel Jones
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite From header from old to new style

Dominic Raferd
On Tue, 22 Oct 2019 at 16:18, Noel Jones <[hidden email]> wrote:
>...
> > I am using postfix 3.3. Apart from cron, the only other local source
> > of such old-style headers that I can find is postfix itself:
> > e.g. From: [hidden email] (Mail Delivery System)
> > - maybe more recent postfix releases use the new style?
> >
>
>
> http://www.postfix.org/postconf.5.html#header_from_format

Thanks Noel but I am using that (default) setting already:
# postconf header_from_format
header_from_format = standard

I find the same behaviour in postfix 3.3.0 and 3.3.2.
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite From header from old to new style

Noel Jones-2
On 10/22/2019 10:27 AM, Dominic Raferd wrote:

> On Tue, 22 Oct 2019 at 16:18, Noel Jones <[hidden email]> wrote:
>> ...
>>> I am using postfix 3.3. Apart from cron, the only other local source
>>> of such old-style headers that I can find is postfix itself:
>>> e.g. From: [hidden email] (Mail Delivery System)
>>> - maybe more recent postfix releases use the new style?
>>>
>>
>>
>> http://www.postfix.org/postconf.5.html#header_from_format
>
> Thanks Noel but I am using that (default) setting already:
> # postconf header_from_format
> header_from_format = standard
>
> I find the same behaviour in postfix 3.3.0 and 3.3.2.
>


Then whatever is generating the mail uses the obsolete format.  You
can use a header_checks IGNORE action to remove the offending
header, and postfix will add it back.



   -- Noel Jones
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite From header from old to new style

Wietse Venema
Noel Jones:

> On 10/22/2019 10:27 AM, Dominic Raferd wrote:
> > On Tue, 22 Oct 2019 at 16:18, Noel Jones <[hidden email]> wrote:
> >> ...
> >>> I am using postfix 3.3. Apart from cron, the only other local source
> >>> of such old-style headers that I can find is postfix itself:
> >>> e.g. From: [hidden email] (Mail Delivery System)
> >>> - maybe more recent postfix releases use the new style?
> >>>
> >>
> >>
> >> http://www.postfix.org/postconf.5.html#header_from_format
> >
> > Thanks Noel but I am using that (default) setting already:
> > # postconf header_from_format
> > header_from_format = standard
> >
> > I find the same behaviour in postfix 3.3.0 and 3.3.2.
> >
>
>
> Then whatever is generating the mail uses the obsolete format.  You
> can use a header_checks IGNORE action to remove the offending
> header, and postfix will add it back.

That is a better suggestion than using header_checks. However this
works only for /usr/bin/sendmail submission.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite From header from old to new style

Dominic Raferd
On Tue, 22 Oct 2019 at 17:05, Wietse Venema <[hidden email]> wrote:

>
> Noel Jones:
> > On 10/22/2019 10:27 AM, Dominic Raferd wrote:
> > > On Tue, 22 Oct 2019 at 16:18, Noel Jones <[hidden email]> wrote:
> > >> ...
> > >>> I am using postfix 3.3. Apart from cron, the only other local source
> > >>> of such old-style headers that I can find is postfix itself:
> > >>> e.g. From: [hidden email] (Mail Delivery System)
> > >>> - maybe more recent postfix releases use the new style?
> > >>>
> > >>
> > >>
> > >> http://www.postfix.org/postconf.5.html#header_from_format
> > >
> > > Thanks Noel but I am using that (default) setting already:
> > > # postconf header_from_format
> > > header_from_format = standard
> > >
> > > I find the same behaviour in postfix 3.3.0 and 3.3.2.
> > >
> >
> >
> > Then whatever is generating the mail uses the obsolete format.  You
> > can use a header_checks IGNORE action to remove the offending
> > header, and postfix will add it back.
>
> That is a better suggestion than using header_checks. However this
> works only for /usr/bin/sendmail submission.

I will try this, thanks. but it still seems to me that local
double-bounce messages, which surely originate from Postfix, are using
the legacy From header. I have put a (lightly obfuscated and
shortened) example at https://pastebin.com/mVqGjAn2 which was
generated while the server's internet connection was down - note the
From: header.
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite From header from old to new style

Dominic Raferd


On Tue, 22 Oct 2019 at 17:24, Dominic Raferd <[hidden email]> wrote:
On Tue, 22 Oct 2019 at 17:05, Wietse Venema <[hidden email]> wrote:
>
> Noel Jones:
> > On 10/22/2019 10:27 AM, Dominic Raferd wrote:
> > > On Tue, 22 Oct 2019 at 16:18, Noel Jones <[hidden email]> wrote:
> > >> ...
> > >>> I am using postfix 3.3. Apart from cron, the only other local source
> > >>> of such old-style headers that I can find is postfix itself:
> > >>> e.g. From: [hidden email] (Mail Delivery System)
> > >>> - maybe more recent postfix releases use the new style?
> > >>>
> > >>
> > >>
> > >> http://www.postfix.org/postconf.5.html#header_from_format
> > >
> > > Thanks Noel but I am using that (default) setting already:
> > > # postconf header_from_format
> > > header_from_format = standard
> > >
> > > I find the same behaviour in postfix 3.3.0 and 3.3.2.
> > >
> >
> >
> > Then whatever is generating the mail uses the obsolete format.  You
> > can use a header_checks IGNORE action to remove the offending
> > header, and postfix will add it back.
>
> That is a better suggestion than using header_checks. However this
> works only for /usr/bin/sendmail submission.

I will try this, thanks. but it still seems to me that local
double-bounce messages, which surely originate from Postfix, are using
the legacy From header. I have put a (lightly obfuscated and
shortened) example at https://pastebin.com/mVqGjAn2 which was
generated while the server's internet connection was down - note the
From: header.

I can confirm that Noel's suggestion (using IGNORE in header_checks) works - this corrects the 'From' header in messages from the local Cron Daemon from the 'obsolete' to the new 'standard' format. Thank you.

However I think double-bounce messages in Postfix 3.3 do not observe the header_from_format setting and instead use the 'obsolete' format.
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite From header from old to new style

Maggie Q Roth
Hi

I am newbie on technology sorry.

Do you know how I setup gmail to forward to a group of other emails? From their webmail I can setup the only one. Will postfix do this stuff? 

Maggie 




On Tue, 22 Oct 2019 at 17:24, Dominic Raferd <[hidden email]> wrote:
On Tue, 22 Oct 2019 at 17:05, Wietse Venema <[hidden email]> wrote:
>
> Noel Jones:
> > On 10/22/2019 10:27 AM, Dominic Raferd wrote:
> > > On Tue, 22 Oct 2019 at 16:18, Noel Jones <[hidden email]> wrote:
> > >> ...
> > >>> I am using postfix 3.3. Apart from cron, the only other local source
> > >>> of such old-style headers that I can find is postfix itself:
> > >>> e.g. From: [hidden email] (Mail Delivery System)
> > >>> - maybe more recent postfix releases use the new style?
> > >>>
> > >>
> > >>
> > >> http://www.postfix.org/postconf.5.html#header_from_format
> > >
> > > Thanks Noel but I am using that (default) setting already:
> > > # postconf header_from_format
> > > header_from_format = standard
> > >
> > > I find the same behaviour in postfix 3.3.0 and 3.3.2.
> > >
> >
> >
> > Then whatever is generating the mail uses the obsolete format.  You
> > can use a header_checks IGNORE action to remove the offending
> > header, and postfix will add it back.
>
> That is a better suggestion than using header_checks. However this
> works only for /usr/bin/sendmail submission.

I will try this, thanks. but it still seems to me that local
double-bounce messages, which surely originate from Postfix, are using
the legacy From header. I have put a (lightly obfuscated and
shortened) example at https://pastebin.com/mVqGjAn2 which was
generated while the server's internet connection was down - note the
From: header.

I can confirm that Noel's suggestion (using IGNORE in header_checks) works - this corrects the 'From' header in messages from the local Cron Daemon from the 'obsolete' to the new 'standard' format. Thank you.

However I think double-bounce messages in Postfix 3.3 do not observe the header_from_format setting and instead use the 'obsolete' format.
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite From header from old to new style

Dominic Raferd
On Wed, 23 Oct 2019 at 16:54, Maggie Q Roth <[hidden email]> wrote:
Hi I am newbie on technology sorry.
Do you know how I setup gmail to forward to a group of other emails? From their webmail I can setup the only one. Will postfix do this stuff? 
Maggie

This is not really a postfix question, you've posted it as an answer to an existing thread, and you've top-posted. But no matter: at the time of writing there are instructions for your requirement at https://www.makeuseof.com/tag/how-to-auto-forward-emails-to-multiple-addresses-in-gmail/. Postfix can do this and more but it may be overkill for what you are trying to achieve.
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite From header from old to new style

Maggie Q Roth
Hi Dominic

How can I set gmail not top-posted? Its default reply is at the top. 

I have read the article, unfortunately I want to forward all messages not to create filters against special conditions.

Someone told me can forward to a commercial pobox account then pobox has the ability to forward to multiple addresses. I am looking into it.

Thank you.
Maggie 


Dominic Raferd <[hidden email]>
On Wed, 23 Oct 2019 at 16:54, Maggie Q Roth <[hidden email]> wrote:
Hi I am newbie on technology sorry.
Do you know how I setup gmail to forward to a group of other emails? From their webmail I can setup the only one. Will postfix do this stuff? 
Maggie

This is not really a postfix question, you've posted it as an answer to an existing thread, and you've top-posted. But no matter: at the time of writing there are instructions for your requirement at https://www.makeuseof.com/tag/how-to-auto-forward-emails-to-multiple-addresses-in-gmail/. Postfix can do this and more but it may be overkill for what you are trying to achieve.