Title: Fatal error: Cannot declare class PHPMailer
Last modified: August 14, 2020

---

# Fatal error: Cannot declare class PHPMailer

 *  Resolved [magefix](https://wordpress.org/support/users/magefix/)
 * (@magefix)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-cannot-declare-class-phpmailer/)
 * Hi there y’all!
 * Anyone getting this error lately?
    “Fatal error: Cannot declare class PHPMailer\
   PHPMailer\PHPMailer, because the name is already in use in /home/edgewate/public_html/
   wp-includes/PHPMailer/PHPMailer.php on line 31”
 * Hopefully a fix will be available soon.
    Cheers!

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

 *  Plugin Author [digamberpradhan](https://wordpress.org/support/users/digamberpradhan/)
 * (@digamberpradhan)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-cannot-declare-class-phpmailer/#post-13255561)
 * Hi [@magefix](https://wordpress.org/support/users/magefix/) ,
    Does the error
   occur when you activate the plugin ? What version of PHP are you using ?
 * since i don’t declare PHPMailer myself i am unsure why this error is showing 
   up.
 *  Thread Starter [magefix](https://wordpress.org/support/users/magefix/)
 * (@magefix)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-cannot-declare-class-phpmailer/#post-13255657)
 * [@digamberpradhan](https://wordpress.org/support/users/digamberpradhan/) error
   occurs when I’m submitting Preview Emails form
    [https://i.imgur.com/CXbYWMSl.png](https://i.imgur.com/CXbYWMSl.png)
   I’m running PHP 7.3.21
    -  This reply was modified 5 years, 10 months ago by [magefix](https://wordpress.org/support/users/magefix/).
 *  Plugin Author [digamberpradhan](https://wordpress.org/support/users/digamberpradhan/)
 * (@digamberpradhan)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-cannot-declare-class-phpmailer/#post-13256297)
 * Hi [@magefix](https://wordpress.org/support/users/magefix/) ,
 * i’ve tested it out on multiple settings and systems – i am unable to reproduce
   this error . Please see if you have used or made some recent changes that is 
   dependent on phpmailer as wordpress by default include phpmailer this might be
   causing the trouble.
 * Please try sending email from your site too – i think it’s a sitewide issue for
   you.
 *  Plugin Author [digamberpradhan](https://wordpress.org/support/users/digamberpradhan/)
 * (@digamberpradhan)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/fatal-error-cannot-declare-class-phpmailer/#post-13595956)
 * Marking as closed.

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

The topic ‘Fatal error: Cannot declare class PHPMailer’ is closed to new replies.

 * ![](https://ps.w.org/woo-preview-emails/assets/icon-256x256.png?rev=3019089)
 * [Preview E-mails for WooCommerce](https://wordpress.org/plugins/woo-preview-emails/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-preview-emails/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-preview-emails/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-preview-emails/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-preview-emails/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-preview-emails/reviews/)

## Tags

 * [phpmailer](https://wordpress.org/support/topic-tag/phpmailer/)

 * 4 replies
 * 2 participants
 * Last reply from: [digamberpradhan](https://wordpress.org/support/users/digamberpradhan/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/fatal-error-cannot-declare-class-phpmailer/#post-13595956)
 * Status: resolved