On Sun, Jan 21, 2024 at 06:53:58PM +0100, Simon Hoffmann via Postfix-users 
wrote:

> > This copies only the message headers and body, but fails to capture the
> > message envelope, which contains the true recipient list.  With
> > per-recipient addressing in "recipient_bcc_maps", and provided the
> > archive system captures the message envelope, you don't lose that (IMHO
> > essential) information.
> > 
> >     MAIL FROM:<envelope-sen...@example.net>
> >     RCPT TO:<b...@example.org>
> >     RCPT TO:<b...@example.org>
> >     DATA
> >     From:<some-other-sen...@somewhere.com>
> >     To: <fake-recipi...@example.org>
> >     Subject: Let's commit fraud
> > 
> >     ...
> >     .
> > 
> > With "always_bcc" one might assume that the message went to
> > "fake-recipient", where in real-life it was sent to "bcc1" and "bcc2".
> > With per-recipient bcc addresses that are captured by the archive,
> > this is not the case.
> 
> MailStore only states the "always_bcc" approach in their manual
> https://help.mailstore.com/en/server/index.php?title=Archiving_Emails_from_Linux-based_Email_Servers#Archiving_Incoming_and_Outgoing_Emails_Directly

That's a nuisance to overcome... :-(

> AFAIK, Mailstore only support this "basic mode" where it uses the header 
> information
> when importing from generic servers or the specific Exchange/Office365 
> Journaling
> format. 
> 
> Additionally, I have only a single destination email address available
> to import into the archive, as each email address specifies which
> (customer) archive this mail should be imported as this is a multi
> tenant software.  With your approach, I would need a catchall at the
> archive software if I understand correctly.

You'll need to deliver to a proxy delivery agent that converts the BCC
recipient addresses to suitable headers, and then reinjects the modified
message for delivery to just the single archive address.

> We could however try to implement the Exchange Journal format.

That's the right solution.

> This creates a new email, adds the envelope from and to address to the
> body, and then attaches the actual email as an eml attachment. So I
> could either write a script as a milter or use a service in master.cf
> that calls a script and passes the envelope and mail data to the
> script and the script then builds a new email in Exchange Journal
> format and transfers it directly to the archive gateway server without
> going through postfix again.

Correct.  This is what what was implemented at a previous employer when
I played a role in making archiving work.

> If you're bored feel free to send in suggestions for the script :) ^^
> Otherwise I'll use always_bcc for now and try to figure out the script
> in a few weeks when I have more time.

The always_bcc approach is flawed, so best to implement the
encapsulation delivery agent promptly.  The recipient_bcc_maps generated
recipients become arguments to the script, which just has to prepend a
stock header and MIME boundary, output the envelope encoding, then
the message, and append the closing MIME boundary.  This is rather
simple.  You don't need to parse the input message.

    Various-Headers: ...
    Content-Type: multipart/...; boundary = $longish-random$

    --$longish-random$
    Content-Type: <envelope-data-type>

    <envelope-data>

    --$longish-random$
    Content-Type: message/rfc822

    <original-message>

    --$longish-random$--

-- 
    Viktor.
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to