D
D
Dmaw2018-04-06 13:22:00
PHPMailer
Dmaw, 2018-04-06 13:22:00

How to connect the new version of PHPMailer 6.0.5?

Good afternoon!
I can’t figure out how to connect the new version of PHPMailer, the files have become much smaller and the connection principle is different.
The example says to connect like this:

use PHPMailer\PHPMailer\PHPMailer;
date_default_timezone_set('Etc/UTC');
require '../vendor/autoload.php';
$mail = new PHPMailer;

My library folder is located in inc/PHPMailer
No matter how I try to set the path, I always get an error 500:
use inc\PHPMailer;
date_default_timezone_set('Etc/UTC');
require '../vendor/autoload.php';
$mail = new PHPMailer;

There is another example, with it I also do not get anything.
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'path/to/PHPMailer/src/Exception.php';
require 'path/to/PHPMailer/src/PHPMailer.php';
require 'path/to/PHPMailer/src/SMTP.php';

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gleb Starkov, 2018-04-06
@colonel

PHPMailer apparently should be in the vendor (Connect via composer)
Although, if the second example is from the documentation, it should also work.
It's just that they didn't spell it out carefully.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question