P
P
pavlinux2016-03-15 14:52:19
Email
pavlinux, 2016-03-15 14:52:19

What is the algorithm for generating Content-Type: boundary?

What is the algorithm for generating the boundary parameter when creating MIME emails, specifically with inline attachments?

Given: Outlook 14.

Content-Type: multipart/related; 
             boundary="----=_NextPart_000_0074_01D17EA2.0CF612B0"

This is a multipart message in MIME format.

------=_NextPart_000_0074_01D17EA2.0CF612B0
Content-Type: multipart/alternative;
  boundary="----=_NextPart_001_0075_01D17EA2.0CF612B0"

------=_NextPart_001_0075_01D17EA2.0CF612B0
Content-Type: text/plain;
  charset="UTF-8"
Content-Transfer-Encoding: base64
....


Here we see that the boundary is nested:
1 NextPart_00 0 _007 4 _01D17EA2.0CF612B0
2 NextPart_00 1 _007 5 _01D17EA2.0CF612B0

Okay, that's not the point. If I amend this letter, having slightly corrected the header, and send it to sendmail,
then it will be displayed perfectly both in Google Mail and in mail clients (OutLook 14/TB 38)
But if I change at least one byte in the boundary values , then the letter will be displayed as text, starting with "This is a multipart message in MIME format."

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Dubrovin, 2016-03-15
@pavlinux

There is no single algorithm, each application uses its own algorithm, and even a boundary consisting of a single character will work. The only requirement is the uniqueness of the boundary within one letter. If you see "This is a multipart message in MIME format" then the boundary simply does not match, do not forget that --boundary is used as a part separator and --boundary-- at the end (there are two additional minuses at the beginning and at the end) .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question