Laravel validate SMTP server settings

The Laravel framework contains several packages to send emails from the Laravel project. SMTP, Mailgun, Postmark, and Amazon SES are used in Laravel for sending simple, transactional, and bulk emails. Laravel has an email-sending library named SwiftMailer to send an email with an email template.

Laravel validate SMTP server settings

How to send an Email in Laravel using Gmail SMTP Server

Sending Email for Laravel Applications

Step 1: Configure Gmail SMTP Server in Laravel Application

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=ENTER_YOUR_EMAIL_ADDRESS(GMAIL)
MAIL_PASSWORD=ENTER_YOUR_GMAIL_PASSWORD
MAIL_ENCRYPTION=ssl

Step 2: Configure your Google Account

Step 3: Send Emails from your Laravel Application

$to_name = ‘RECEIVER_NAME’;
$to_email = ‘RECEIVER_EMAIL_ADDRESS’;
$data = array(‘name’=>”Ogbonna Vitalis(sender_name)”, “body” => “A test mail”);
Mail::send(‘emails.mail’, $data, function($message) use ($to_name, $to_email) {$message->to($to_email, $to_name)->subject(Laravel Test Mail’);$message->from(‘SENDER_EMAIL_ADDRESS’,’Test Mail’);});
Hello <strong>{{ $name }}</strong>,
<p>{{body}}</p>

Click Here to Visit

What's Your Reaction?

like
0
dislike
0
love
0
funny
0
angry
0
sad
0
wow
0