rob-luke / emails-html-to-pdf

Convert emails without attachments to pdf and send as email
32 stars 7 forks source link

Error while loading/opening URL #5

Closed smseidl closed 2 years ago

smseidl commented 2 years ago

I tried to send a Paypal receipt email to Paperless via the Email to PDF and got the below error. I don't understand why it's trying to load this page instead of the actual email... thoughts?

email2pdf    |
email2pdf    | No attachments in: You have authorized a payment to XXXXXXXX Inc.
email2pdf    |
email2pdf    | PDF: You-have-authorized-a-payment-to-XXXXXXXX_.pdf
email2pdf    |
email2pdf    | PDF: You-have-authorized-a-payment-to-XXXXXXXX_.pdf
email2pdf    | Traceback (most recent call last):
email2pdf    |   File "/app/main.py", line 98, in <module>
email2pdf    |     process_mail(imap_url=server_imap,
email2pdf    |   File "/app/main.py", line 72, in process_mail
email2pdf    |     pdfkit.from_string(html, filename)
email2pdf    |   File "/usr/local/lib/python3.9/site-packages/pdfkit/api.py", line 72, in from_string
email2pdf    |     return r.to_pdf(output_path)
email2pdf    |   File "/usr/local/lib/python3.9/site-packages/pdfkit/pdfkit.py", line 156, in to_pdf
email2pdf    |     raise IOError('wkhtmltopdf reported an error:\n' + stderr)
email2pdf    | OSError: wkhtmltopdf reported an error:
email2pdf    | QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
email2pdf    | Loading page (1/2)
Error: Failed to load https://t.paypal.com/ts?xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, with network status code 1 and http status code 0 - Connection refused
Printing pages (2/2)                                                        ] 25%
Done                                                                        ]
email2pdf    | Exit with code 1 due to network error: ConnectionRefusedError
email2pdf    |
rob-luke commented 2 years ago

Whats at the address that its trying to load? Is it a tracker or image etc? But I am with you on this, I'm not sure what the problem might be.

I'll make a PayPal purchase and try and reproduce the issue myself.

smseidl commented 2 years ago

Yes, I think in the case for paypal it was a tracker image. Looks like it was only 1 px in size.

On Sat, Sep 25, 2021 at 11:37 PM Robert Luke @.***> wrote:

Whats at the address that its trying to load? Is it a tracker or image etc? But I am with you on this, I'm not sure what the problem might be.

I'll make a PayPal purchase and try and reproduce the issue myself.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rob-luke/emails-html-to-pdf/issues/5#issuecomment-927229830, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFTXB7H5NXK5X47W7WB326DUD2PPXANCNFSM5ET4ECFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

rob-luke commented 2 years ago

Cross referencing #11 and #12

rob-luke commented 2 years ago

Closed by #12 Reopen if not fixed for you