phpMailer __autoload() is deprecated,

I use phpMailer for the processing of mail sent from the website. This morning I suddenly got the following message:

__autoload() is deprecated

I have PHP 7.1 running on the server

I’m sure you are familiar with PHPMailer but this is in PHPMailerAutoload

if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
    //SPL autoloading was introduced in PHP 5.1.2
    if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
        spl_autoload_register('PHPMailerAutoload', true, true);
    } else {
        spl_autoload_register('PHPMailerAutoload');
    }
} else {
    /**
     * Fall back to traditional autoload for old PHP versions
     * @param string $classname The name of the class to load
     */
    function __autoload($classname)
    {
        PHPMailerAutoload($classname);
    }
}

Like I said I use PHP 7.1 so I have know idea why I get that message?

It is what it is: deprecated. Like the red box says in the manual on php.net. I do not see any __autoload in the main file on the projects github repo, so i guess you forgot to upgrade your packet to a recent version that’s more compatible with your PHP version.

2 Likes

Use the newer versions of PHPMailer. I believe they fixed this problem. I’ll have to go back and check to make sure. It is also wise to download it using Composer.

@chorn & @spaceshiptrooper . Thank you both for the reply. That was indeed the case. Thanx for pointing me out

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.