Hi,
thanks for reporting this.
I don’t the source you shared, but I did the following test, where the mail was successfully send:
The Maileroo smtp SMTP set in API mode
Installed the PDF invoice plugin from WP Overrnight
Changed the order status to complete to send a mail with the invoice attached.
Can you try this, or if you don’t like please try the SMTP mode from the Maileroo plugin.
I tried it also with CMB2 plus the class from that website. The mail was send including the attachments. Based on the error message it might be also an attachment that can’t be parsed for email messages. Do you tried to add different attachements?
Please let me know how this worked for you.
It seems like the issue is related to this piece of block:
230 if (!empty($attachments)) {
231 $payload['attachments'] = array();
232 foreach ($attachments as $key => $attachment) {
233 $payload['attachments'][] = array(
234 'file_name' => basename($attachment),
235 'content_type' => mime_content_type($attachment),
236 'content' => base64_encode(file_get_contents($attachment)),
237 'inline' => false
238 );
239 }
240 }
@finalwebsites Let’s add an if statement here checking if the attachment is valid or not.
if (!$attachment) {
continue;
}
Hello
I have something else to add in my first post. The problem appears only when I turn the order to completed by clicking the complete button inside the admin orders’ list and not when I do the same from the admin product page
https://prnt.sc/RFInnzWaZzOy
I also checked two different situations. With or without upload an attachment. Every time I see the same php fatal error.
Hope I helped you somehow
Leonidas
-
This reply was modified 3 weeks ago by
Leonidas.
-
This reply was modified 3 weeks ago by
Leonidas.
Thanks for the additional information. In the mean time I did also more tests and I got finally the same errors you got.
In my first test, the PDF invoice plugin was still active. After deactivation I got similar errors.
Based on this, I added some validations to avoid the fatal errors. I will publish a new plugin version within the next hour.
For your own case I suggest to use a different solution, because the class script is doing something wrong. And that’s why the error occurs inside the Maileroo mail function
I’m not saying your solution is bad, but it could be better. The problem you’re having today could also arise tomorrow with a different feature. Furthermore, your solution requires installing a plugin that hasn’t been updated in two years. Perhaps this plugin would work for you?
https://wordpress.org/plugins/woo-product-attachment/