Jump to content

Composer and PHPMailer issue


gmc1103
Go to solution Solved by gmc1103,

Recommended Posts

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, 

post-174418-0-10593400-1464011217_thumb.png

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.