Title: PHP Fatal error
Last modified: November 1, 2025

---

# PHP Fatal error

 *  [Leonidas](https://wordpress.org/support/users/visionoptika/)
 * (@visionoptika)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/php-fatal-error-484/)
 * Hello
 * I wanted to attach files to woocommerce order email. Following this guide [https://www.damiencarbery.com/2021/05/attach-files-to-woocommerce-order-email/](https://www.damiencarbery.com/2021/05/attach-files-to-woocommerce-order-email/)
   I managed to achieve it but when I set the order status to complet a php fatal
   appear.
 * [https://prnt.sc/qM9JJvok4yeX](https://prnt.sc/qM9JJvok4yeX)
 * [https://prnt.sc/PagzKCzqgBg4](https://prnt.sc/PagzKCzqgBg4)
 * Do you think is something that can be fixed?
 * Regards
 * Leonidas

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Olaf Lederer](https://wordpress.org/support/users/finalwebsites/)
 * (@finalwebsites)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/php-fatal-error-484/#post-18703590)
 * 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 OverrnightChanged 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.
 *  Plugin Author [Olaf Lederer](https://wordpress.org/support/users/finalwebsites/)
 * (@finalwebsites)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/php-fatal-error-484/#post-18703597)
 * 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.
 *  Plugin Author [Areeb Majeed](https://wordpress.org/support/users/areebmajeed/)
 * (@areebmajeed)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/php-fatal-error-484/#post-18703724)
 * It seems like the issue is related to this piece of block:
 *     ```wp-block-code
       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' => false238	            );239	        }240	    }
       ```
   
 * [@finalwebsites](https://wordpress.org/support/users/finalwebsites/) Let’s add
   an if statement here checking if the attachment is valid or not.
 *     ```wp-block-code
       if (!$attachment) {    continue; }
       ```
   
 *  Thread Starter [Leonidas](https://wordpress.org/support/users/visionoptika/)
 * (@visionoptika)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/php-fatal-error-484/#post-18703980)
 * 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](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 7 months, 1 week ago by [Leonidas](https://wordpress.org/support/users/visionoptika/).
    -  This reply was modified 7 months, 1 week ago by [Leonidas](https://wordpress.org/support/users/visionoptika/).
 *  Plugin Author [Olaf Lederer](https://wordpress.org/support/users/finalwebsites/)
 * (@finalwebsites)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/php-fatal-error-484/#post-18704008)
 * 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/](https://wordpress.org/plugins/woo-product-attachment/)

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP Fatal error’ is closed to new replies.

 * ![](https://ps.w.org/simple-smtp-by-maileroo/assets/icon.svg?rev=3131913)
 * [Simple SMTP by Maileroo](https://wordpress.org/plugins/simple-smtp-by-maileroo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-smtp-by-maileroo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-smtp-by-maileroo/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-smtp-by-maileroo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-smtp-by-maileroo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-smtp-by-maileroo/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Olaf Lederer](https://wordpress.org/support/users/finalwebsites/)
 * Last activity: [7 months, 1 week ago](https://wordpress.org/support/topic/php-fatal-error-484/#post-18704008)
 * Status: not resolved