I have a shared godaddy server. I'm trying to send a verification email upon user registration. However, it seems like no matter how many times I change my .env file or mail.php it won't work. Even if I do php artisan config:cache it still won't work. An earlier post (I don't have the link) suggested I change the MAIL_DRIVER to sendmail. Althought this fixed the previous error of the connection being refused it still isn't working.
.env
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=username
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
mail.php
'driver' => env('MAIL_DRIVER', 'sendmail'),
'host' => env('MAIL_HOST', 'smtp.googlemail.com'),
'port' => env('MAIL_PORT', 465),
'from' => [
        'address' => 'user@gmail.com',
        'name' => 'name',
    ],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => 'user',
'password' => 'password',
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
        'theme' => 'default',
        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],
The username has .com in it because it's for a website. I don't know if this is relevant but just thought I'd include as many details as possible.
I've tried different port numbers, no success. I've tried hard coding all the values in the mail.php file with no success. It just continues to say Cannot send message without a sender address
Here's my mailing function:
public function toMail($notifiable)
    {
        return (new MailMessage)
                    ->from(env('username.com'))
                    ->subject("Hi $this->user->first_name,")
                    ->line("You've successfully created you're new Xxxxxx account!")
                    ->action('Activate Your Account', route('activate.user', $this->user->verify_code));
    }
via Chebli Mohamed
 
Aucun commentaire:
Enregistrer un commentaire