PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Fatal error: Cannot redeclare class PHPMailer

  1. Hello,

    I just purchased this theme. When I go to test the form and I submit all the entries I get the following message:
    "Fatal error: Cannot redeclare class PHPMailer in /----/html/wp-includes/class-phpmailer.php on line 34"

    I can't seem to figure out this problem. I love this plugin and would love to keep it as long as it works. Please help me resolve this issue soon.

    Posted 12 years ago on Wednesday June 22, 2011 | Permalink
  2. Also FYI, I just realized after testing some times, I get all the submissions under the "Entries" section. It's just when the page is redirected I get a blank page with that error.

    Posted 12 years ago on Wednesday June 22, 2011 | Permalink
  3. Send us a WordPress admin login for your site as well as an FTP login and I can take a look and see what is going on so we can get it resolved.

    It's something specific to your site, but we can help you determine what it is and how to fix it. You can send me the necessary login information via our Contact Us form here: http://www.gravityforms.com/contact-us/

    Please reference this forum post when doing so that way we know what it is in reference to.

    Posted 12 years ago on Wednesday June 22, 2011 | Permalink
  4. The problem is your theme, it was developed by a theme developer that doesn't understand what they are doing and doesn't follow best practices. It is including a PHP file that it should not be including, phpmailer. This is what is breaking things.

    PHPMailer is built into WordPress and is relied on by plugins that send email using the wp_mail() function. Themes and plugins shouldn't be including their own version, because it causes this error to occur if you do.

    See this screenshot of your themes functions.php file, notice the first require_once line in the code: http://grab.by/apU2

    I went ahead and removed this line and the form is now submitting without any problems.

    These issues are common with themes purchased from ThemeForest because they are usually developed by theme developers that don't really understand WordPress development. They look pretty, but they are terrible under the hood.

    Posted 12 years ago on Thursday June 23, 2011 | Permalink

This topic has been resolved and has been closed to new replies.