Skip to content

WordPress 5.5 deprecates class-phpmailer.php  #11

@Benunc

Description

@Benunc

With WP_Debug on, you'll see a notice in 5.5 about deprecated PHP Mailer issues.

For reference, Here's how the Delicious Brains team is handling calling that class now, which includes backward compatibility:

	/**
	 * Gets the PHP Mailer instance.
	 * 
	 * Backwards-compatibility for pre-5.5 versions of WordPress.
	 *
	 * @return PHPMailer
	 */
	public function get_PHPMailer() {
		if ( file_exists( ABSPATH . WPINC . '/PHPMailer/PHPMailer.php' ) ) {
			require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php';
			require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
			$PHPMailer = new \PHPMailer\PHPMailer\PHPMailer();
		} else {
			require_once ABSPATH . WPINC . '/class-phpmailer.php';
			$PHPMailer = new \PHPMailer( true );
		}

		return $PHPMailer;
	}

I briefly tried to fork this plugin and make a PR for that change, but it kept breaking. Hopefully this is enough rails to run on for you to resolve this!

I use email cop on lots of test sites, and love it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions