gmc1103 Posted May 23, 2016 Share Posted May 23, 2016 Hi Can someone help me with the following issue Fatal error: Class 'PHPMailer' not found I have installed the phpmailer from composer....so i don't undertstand whats going on This is my composer.json { "name": "vendor_name/package_name", "description": "site esmaior", "minimum-stability": "stable", "license": "proprietary", "authors": [ { "name": "GMC", "email": "test@gmail.com" } ], "require": { "phpmailer/phpmailer": "6.0.x-dev" } } This is my function to send email file "class.esmaior.pt" public function enviarEmailVisitas(){ $mail = new PHPMailer; $mail->isSendmail(); $mail->setFrom('xxxxx@xxxx.pt', 'First Last'); $mail->addReplyTo('xxxxx@xxxx.pt', 'First Last'); $mail->addAddress('xxxxx@xxxx.pt', 'John Doe'); $mail->Subject = 'PHPMailer sendmail test'; $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); $mail->AltBody = 'This is a plain-text message body'; $mail->addAttachment('images/phpmailer_mini.png'); if (!$mail->send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; } } And the autoload is inserted in the file "class.esmaior.pt" error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); require_once "dbconfig.php"; require_once __DIR__ . '/../vendor/autoload.php'; setlocale(LC_ALL, NULL); setlocale(LC_ALL, 'pt_PT'); Any help, Quote Link to comment Share on other sites More sharing options...
Solution gmc1103 Posted May 23, 2016 Author Solution Share Posted May 23, 2016 The problem was here: I miss those lines use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.