Search code examples
smtplaravel-5.4swiftmailerdreamhostmailmessage

Class Swift_Transport_Esmtp_Auth_CramMd5Authenticator does not exist


I can't seem to send an email with laravel 5.4 on after setting the right configurations in config/mail.php. I'm using smtp driver here is summary of my files.
Here is the config/mail.php

<?php
return [
    'driver'=>env('MAIL_DRIVER', 'smtp'),       
    'host'=>env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => [
    'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
    'name' => env('MAIL_FROM_NAME', 'National President'),
],
'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
'username' => env('MAIL_USERNAME', 'my-gmail-email'),
'password' => env('MAIL_PASSWORD', 'my-gmail-password'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
    'theme' => 'default',
    'paths' => [
        resource_path('views/vendor/mail'),
    ],
],              

This is the SendActivationEmail class

<?php

use Illuminate\Bus\Queueable;                                      
use Illuminate\Notifications\Notification;                                  
use Illuminate\Contracts\Queue\ShouldQueue;                                
use Illuminate\Notifications\Messages\MailMessage;                                    


class SendActivationEmail extends Notification {
    use Queueable;                                                     
    protected $token;                                                  
    public function __construct($token) {
        $this->token = $token;
    }

    public function via($notifiable){
        return ['mail', 'database'];
    }

    public function toMail($notifiable) {
        return (new MailMessage)->subject('Activation Your Account')->greeting('Hello!')->line('You need to activate your email before you can login.')->action('Activate Email', route('activate_account', ['token' => $this->token]))->line('Thank you for joining our Online Community!');
    }
 }      
?>

This is the top part of the error

(1/1) ReflectionException

Class Swift_Transport_Esmtp_Auth_CramMd5Authenticator does not exist in DependencyContainer.php (line 309)

I will be grateful for any help to resolve this error on dreamhost, thanks.


Solution

  • The best way to resolve this problem is to delete the files in the vendor folder and redo composer install and composer update, that's how I fixed my problem