I am trying to sent an email using laravel 5.6 but I fail.
In my .env file I put my private gmail, so that all mails are sent to this email.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
Further I created a Mailable class like this:
class InquirySent extends Mailable
{
use Queueable, SerializesModels;
public $data;
public function __construct($data)
{
$this->data = $data;
}
public function build()
{
return $this->from($this->data['email'])
->view('emails.contacts.inquiry');
}
}
I just Need to add this data to the mail which I get from a form:
array:3 [
"name" => "foo"
"email" => "[email protected]"
"phoneNumber" => "16547613247805"
]
In my Controller I have following function to sent the mail:
public function sent(ContactRequest $request)
{
$data = $request->all();
Mail::to(env('MAIL_USERNAME'))->send(new InquirySent($data));
}
The error message:
{,…}
exception
:
"ErrorException"
file
:
"D:\laragon\www\tim\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php"
line
:
94
message
:
"stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:↵error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed"
trace
:
[{function: "handleError", class: "Illuminate\Foundation\Bootstrap\HandleExceptions", type: "->"},…]