andrewferrier / email2pdf

Script to convert emails to PDF from the command-line, as well as detach recognized attachments. Helps to process incoming emails and assist automatically with a non-paper paperwork workflow. Designed to work in tandem with getmail to convert forwarded emails to PDF automatically.
MIT License
67 stars 36 forks source link

Email boundary failing - InvalidMultipartContentTransferEncodingDefect #115

Open victorromeo opened 4 years ago

victorromeo commented 4 years ago

I'm trying to create an automated PDF from my receipts using email2pdf via getmail, however I'm getting a boundary error on my first email. May I please get your thoughts? Does email2pdf support merging pdfs, when an email already contains a pdf?

getmail conversion failing due to boundary

Delivery error (command email2pdf 26909 error (2, ERROR: Defects parsing email: [InvalidMultipartContentTransferEncodingDefect(), InvalidMultipartContentTransferEncodingDefect()])) msg 1/2 (73288 bytes) from support@someonlinestore.com.au, delivery error (command email2pdf 26909 error (2, ERROR: Defects parsing email: [InvalidMultipartContentTransferEncodingDefect(), InvalidMultipartContentTransferEncodingDefect()])) Delivery error (command email2pdf 26915 error (2, ERROR: Defects parsing email: [InvalidMultipartContentTransferEncodingDefect(),

Where the boundaries appear fine

Head Boundary

Content-Type: multipart/mixed;
 boundary="=_72dd989526b129478b16620bd1f9726f"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
MIME-Version: 1.0
X-getmail-retrieved-from-mailbox: Receipts
X-GMAIL-LABELS: =?utf-8?b?IlxcSW1wb3J0YW50IiAiXFxJbmJveCI=?=
X-GMAIL-THRID: =?utf-8?q?1647315770560521704?=
X-GMAIL-MSGID: =?utf-8?q?1647315770560521704?=

This is a message in Mime Format.  If you see this, your mail reader does not support this format.

Body Boundary

--=_72dd989526b129478b16620bd1f9726f
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

PDF attachment boundary

--=_72dd989526b129478b16620bd1f9726f
Content-Type: application/pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="invoice2019-10-14_08.pdf"

Closing boundary ` --=_72dd989526b129478b16620bd1f9726f--

`

andrewferrier commented 4 years ago

Victor,

Thanks for the report. I've never seen this. To answer your question, though - no, email2pdf will treat PDF attachments as attachments, so by default it will detach them and output them (unless you add --no-attachments).

Thanks, Andrew.

On Fri, 7 Feb 2020 at 11:58, victorromeo notifications@github.com wrote:

I'm trying to create an automated PDF from my receipts using email2pdf via getmail, however I'm getting a boundary error on my first email. May I please get your thoughts? Does email2pdf support merging pdfs, when an email already contains a pdf?

getmail conversion failing due to boundary

Delivery error (command email2pdf 26909 error (2, ERROR: Defects parsing email: [InvalidMultipartContentTransferEncodingDefect(), InvalidMultipartContentTransferEncodingDefect()])) msg 1/2 (73288 bytes) from support@someonlinestore.com.au, delivery error (command email2pdf 26909 error (2, ERROR: Defects parsing email: [InvalidMultipartContentTransferEncodingDefect(), InvalidMultipartContentTransferEncodingDefect()])) Delivery error (command email2pdf 26915 error (2, ERROR: Defects parsing email: [InvalidMultipartContentTransferEncodingDefect(),

Where the boundaries appear fine

Head Boundary

Content-Type: multipart/mixed; boundary="=_72dd989526b129478b16620bd1f9726f" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: Receipts X-GMAIL-LABELS: =?utf-8?b?IlxcSW1wb3J0YW50IiAiXFxJbmJveCI=?= X-GMAIL-THRID: =?utf-8?q?1647315770560521704?= X-GMAIL-MSGID: =?utf-8?q?1647315770560521704?=

This is a message in Mime Format. If you see this, your mail reader does not support this format.

Body Boundary

--=_72dd989526b129478b16620bd1f9726f Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

PDF attachment boundary

--=_72dd989526b129478b16620bd1f9726f Content-Type: application/pdf Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="invoice2019-10-14_08.pdf"

Closing boundary ` --=_72dd989526b129478b16620bd1f9726f--

`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/andrewferrier/email2pdf/issues/115?email_source=notifications&email_token=AAA2EB26ARJ3SSSES2JPDPLRBVEGRA5CNFSM4KRNKUIKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILZIQGQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2EBYY2VLCANODJHW424TRBVEGRANCNFSM4KRNKUIA .

-- Andrew Ferrier andrew.ferrier@gmail.com