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": "[email protected]" } ], "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('[email protected]', 'First Last'); $mail->addReplyTo('[email protected]', 'First Last'); $mail->addAddress('[email protected]', '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 https://forums.phpfreaks.com/topic/301241-composer-and-phpmailer-issue/ 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 https://forums.phpfreaks.com/topic/301241-composer-and-phpmailer-issue/#findComment-1533175 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.