I am trying to send a mail from my domain email (cPanel), but I didn't receive any mail in my Gmail Account. Also, Laravel didn't display any errors.
.env
MAIL_MAILER=smtp
MAIL_HOST=mail.domain.com
MAIL_PORT=465
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=support@domain.com
MAIL_FROM_NAME="${APP_NAME}"
Also, I add implements MustVerifyEmail to the User model class.
web.php
use Illuminate\Support\Facades\Mail;
use App\Mail\SendUserEmailVerification;
Route::get('/send-email', function () {
Mail::to("myaccount@gmail.com")->send(new SendUserEmailVerification());
return response("success");
});
SendUserEmailVerification.php
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class SendUserEmailVerification extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->markdown('emails.user.email_verfy');
}
}
email_verfy.blade.php
@component('mail::message')
# Introduction
The body of your message.
@component('mail::button', ['url' => ''])
Button Text
@endcomponent
Thanks,<br>
{{ config('app.name') }}
@endcomponent
When I use mailtrap.io, it shows mail in the inbox.
Also, it's working on using PHPMailer as https://github.com/PHPMailer/PHPMailer but it seems a little bit hard to manage email verification on Laravel.
Why I didn't get the mail that Laravel send?
Does anybody know something?
Please guide me.