uchicago-library / attachment-converter

Attachment Converter: tool for batch converting attachments in an email mailbox
GNU General Public License v2.0
8 stars 3 forks source link

Headers for New Multipart Messages #54

Closed nmmull closed 1 year ago

nmmull commented 1 year ago

An email which is only an attachment will have roughly the form

(header,
  (Leaf data))

And so may be converted to something of the form

(~header,
  (Multipart [(header, (Leaf data)),
                     (header, (Leaf data)),
                     (header, (Leaf data))]))

The question is: what should ~header be? We can't simply adopt the header from the original email since this header will have a content disposition of attachment or inline. This header should be the minimal one which indicates that the message is a multipart, and should include some custom header field which says that we constructed it.

Note that the function make_header can be used here.

nmmull commented 1 year ago

In case I forget, I think we could just add an empty header (plus the custom header field). Both Mr.Mime and Ocamlnet will handle the creation of boundaries.

nmmull commented 1 year ago

My comment above was not actually true. The boundaries need to be included in the header, I put a simple dummy string as the boundary, not sure if there is better practice for this.