Attach PDF issue

v5.0.40-C34

When choose “Attach PDF” in Email Settings, emails don’t send out. I can email out invoices / quotes ok without this option enabled.

Im using PhantomJS for pdf creation and it seems to be working everywhere it should. All PDF’s open / previews work.

Hi,

Do you see any related errors in storage/logs/

Doesnt seem to be.

less /storage/logs/laravel.log

I tried to send the invoice email with attachment around 6:50 after all of these entries.

[2020-12-29 04:58:42] production.INFO: db fails
[2020-12-29 05:00:10] production.INFO:
[2020-12-29 05:00:13] production.INFO:
[2020-12-29 05:00:17] production.INFO:
[2020-12-29 05:01:02] production.INFO: latest version = 5.0.40
[2020-12-29 05:01:02] production.INFO: latest version = 5.0.40
[2020-12-29 05:02:27] production.INFO: the path https:///storage/P0zvOcbKraiPFUsj2yVT2dhurQ2uZy4aEa3zGeiK61D36B6rYJjoAGeR6pcwooTQ/V8KCGvGxk3UbPWSlaV9s0dxubwx31OuCjJdLSyeD.png
[2020-12-29 05:07:14] production.INFO: https:///phantom/invoice/uH38ujOaSoO7GZpdAwPE3hxvLPFGRuKQ5VbSwGoWmcYaMuM5hF7ebMHbY2ZjWsEY?phantomjs_secret=secret
[2020-12-29 05:09:06] production.INFO: https:///phantom/invoice/uzOXfYXNJFISJYUa3PYKpWkzkLDC0KmskdGWRh9SbRxO6O6hyIwGU7A8GMlZ03Ty?phantomjs_secret=secret
[2020-12-29 05:11:21] production.INFO: subject = template data
[2020-12-29 05:13:17] production.INFO: subject = template data
[2020-12-29 05:13:35] production.INFO: subject = template data
[2020-12-29 05:14:00] production.INFO: subject = template data
[2020-12-29 05:16:01] production.INFO: subject = template data
[2020-12-29 06:47:44] production.INFO: subject = template data
[2020-12-29 06:48:07] production.INFO: subject = template data

Hey @david, can you help here, please?

most likely a issue attaching from phantomjs i’ll need to add this to my backlog.

Oh thats interesting… If it could be an issue with phantomjs, I understand that you guys are looking into snappdf? Id actually prefer a local pdf option. I only went to phantomjs becuase i couldnt get node working.

I see an install guide here:

And I read on this forum theres some variables available to enter in the .env file?

EXPERIMENTAL_PDF_ENGINE=true
EXPERIMENTAL_PDF_ENGINE_CHROMIUM_PATH=/usr/bin/google-chrome

Ill play around with it and see if i can get it working. Any other hints on getting it to work properly?

Thanks!

I dont think the problem is specific to phantomjs.

I installed snappdf and chromium, set PHANTOMJS_PDF_GENERATION=false
EXPERIMENTAL_PDF_ENGINE=true
in the .env file

and then i could generate PDF’s (Looked ok in pdf previews, it was backwards / upside down when viewing in the client portal)

But the point is, i could send out emails only when the attach pdf wasnt enabled. As soon as it was enabled it didnt send the emails.

Hope thats helpful : )

Glad to hear that you solved the issue with PDFs. Yes, we’d be happy if all users are able to run snappdf, but that’s not the case, unfortunately. Some shared hosting providers, don’t provide all the necessary requirements for headless Chromium to work. That’s why PhantomCloud is there as an option.

By the way, you can remove experimental pdf engine flag from your .env & only leave phantom pdf generation as false, if you’re running the latest version.

I will check what’s wrong with sending e-mails when having PDF attached & let you know here.

Thank you!

Thanks! Ive been testing out V5 a lot and it feels like its getting close :smiley:

2 Likes

@ben
Just FYI that attaching a PDF is still preventing emails going out in latest v5.0.44-C37
Thanks!

@peterjm

This issue will be fixed in the next release, third party attachments can also now be included in emails.

@david
Just FYI this is still an issue for me as of 5.0.52-C39. Im trying it with phantomjs this time again but also tried snappdf 1.2 through 1.5

When i turn on the attach pdf option i get one email that the invoice was sent, but the client never receives an email. As soon as i turn off ‘attach pdf’ option emails go to the client again.

@peterjm

So this one I cannot recreate. I am able to send emails with attachments.

If you could check the system_logs table, this may provide more information. You’ll see the email server errors inside there.

ok,

With ‘attach pdf’ turned off system_logs table data shows 2 entries:
“Entity PDF generated sucessfully => 0004”
“Entity PDF generated sucessfully => 0004”
And 2 emails are sent, one informing me invoice was sent and one to customer

With ‘attach pdf’ turned on system_logs table data shows only 1 entry:
“Entity PDF generated sucessfully => 0006”

until i run
sudo php artisan queue:work

Then the second entry appears, but followed by an error:
"Unable to open file for reading [https:\/\/FQDNofmyserver\/storage\/0V1qDzTeunL8DhX0wHX9Z3fiiMEp6hRD9fxIYoWorSgNzeo9D3LXu9j8jS9ilmmd\/eU8PJjakrDqycTSxtpeH6dYmadXMSMmwqDnAeEXP\/invoices\/0007.pdf]"

1 email is sent to me saying unable to send invoice

If i go to the URL manually it loads the PDF but i get a self signed certificate error. Maybe this could be the issue with attaching the PDF. Is I.N trying to attach that PDF into the e-mail from the full https:// URL instead of pulling it directly from storage?

@david any suggestions?

I’ll need to retest PhantomJS with attachments… This could also happen if you run out of quota on phantomjs.

Hi David,
Just an update that this still breaks for me on 5.2.16-C56

The PDF’s generate fine and emails send without attach pdf chosen, but as soon as i choose attach pdf’s the emails dont go through.

Any update on this issue

On the latest build same issue

1 Like

I would try changing

PDF_GENERATOR=hosted_ninja

and see if that fixes it, if it does, then phantom will be the root cause.