i'm trying to use SendGrid in laravel for send emails on my aplication. But this error appears:
stream_socket_enable_crypto(): Peer certificate CN=
*.smtp.sendgrid.net' did not match expected CN=
smtp.sendgrid.com'
I followed all the documentation, everything is the same, but it does not work.
TestMail file:
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class TestEmail extends Mailable
{
use Queueable, SerializesModels;
public $data;
public function __construct($data)
{
$this->data = $data;
}
public function build()
{
$address = 'gabriel.jg04@gmail.com';
$subject = 'Test!';
$name = 'João Gabriel';
return $this->view('emails.test')
->from($address, $name)
->cc($address, $name)
->bcc($address, $name)
->replyTo($address, $name)
->subject($subject)
->with([ 'message' => $this->data['message'] ]);
}
}
My env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME="João Gabriel"
MAIL_PASSWORD=joaobiel04
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME="João Gabriel"
MAIL_FROM_ADDRESS=gabriel_fla04@hotmail.com
My route:
Route::get('/testmail', function () {
$data = ['message' => 'Test!'];
Mail::to('gabriel_fla04@hotmail.com')->send(new TestEmail($data));
return back();
})->name('testmail');
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2HTEJnN
via IFTTT
Aucun commentaire:
Enregistrer un commentaire