Help with MIME module
David Estopá Mesa <[email protected]> Wed, 4 Oct 2017 13:12:37 +0200 (CEST)
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
Hy, Pike Team.
I'w appreciate your help with a problem facing with the use of
MIME.Message() in some situations.
There are some MIME messages that when we process, throw an error like:
multipart message improperly terminated ("\n");
If we inspect mail data manually at low level, we found that some of
them, are correct syntactically, and others clients can process
it without any problem.
When we process mime messages with only one level of boundaries, this
problem occours frequently when some Epilogue text is present at the end
of the last message data boundary.
When we process more complex mime messages (for example, 2nd level mime
objects, formed with two distinct boundary headers), this problem is
raised when some extra break is present in the middle Epilogue zone.
When this error message is throwed, we found that in many cases, three
are some break ("\n") or some blank line to ignore between the final
boundary of the Multipart/alternative message (in 2nd level) and the
next boundary for the main Mime parts (for example, if the main header
is a multipart/mixed).
We are using pike 8.0, but this error was also detected on previous
versions and never solved. We cannot use the laxed option argument,
because this is a poison for all other invalid or very unformated
messages, but we thing that maybe something is not done correctly with
the mime "Epilogue" text (that would be ignored) or when more complex
mime (more than one level) is processed.
See here, that I'm refering when I speak about the processing of the
"Epilogue" and "Preamble" (that these data seems must be ignored by a
mime parser): https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
Finally, I attach two data samples to reproduce it easy, a mime example
received from a customer that cannot be processed correctly with pike
(file original.eml) and the same one modified manually to pass the
current pike process of MIME.Message to make an object (file modified.eml).
> MIME.Message(Stdio.read_bytes("original.eml"));
multipart message improperly terminated ("\n")
/usr/lib/pike7.8/modules/MIME.pmod/module.pmod:1518:
Message(([ ]))->create("From [email protected] Tue Jul 18
14:14:15 2017\nReturn-Path: <[email protected]>\nX-Original-To:
[email protected]\nDe
livered-To: correo@certi"+[2676],UNDEFINED,UNDEFINED,UNDEFINED)
/usr/lib/pike7.8/modules/MIME.pmod/module.pmod:818: MIME->Message()
HilfeInput:1: HilfeInput()->___HilfeWrapper()
> MIME.Message(Stdio.read_bytes("modified.eml"));
(1) Result: Message(([ ]))
You can use meld or similar tool to see visually that they differ
minimally and the mime construction in original.eml seems to be also valid.
Can you analise if we are in reason or not? If the pike process is not
100% correct, can you suggest us a modification to bypas correctly these
situations (without throwing an error)?
Kind regards
*David Estopà Mesa*
Técnico de I+D+i | R&D Technician
[email protected] <mailto:[email protected]>
(+34) 625 434 084
*Parc Científic i Tecnològic Agroalimentari de Lleida*
Edifici H1 2a planta B | 25003 Lleida (Spain)
Tel. (+34) 973 282 300
Fax (+34) 973 282 195
www.lleida.net <http://www.lleida.net>
Política de privacidad <http://www.lleida.net/es/privacy.html>
modified.eml
(application/x-extension-eml, 2.8 KB) - not displayed
original.eml
(application/x-extension-eml, 2.8 KB) - not displayed