0

I'd like to send an email with Swift Mailer and gmail smtp from my local server (Laragon on Windows 10).

First in my Gmail account :

  • 2 step validation is disabled
  • I turned on less security for applications

In my PHP file I create the swift transport like this :

// Create the Transport
$transport = (new Swift_SmtpTransport('smtp.gmail.com', 587, 'tls'))
    ->setUsername('*****@gmail.com')
    ->setPassword('******')
;

Then this error occurs I don't understand :

Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in F:\laragon\www\web-developer\PHP\PHP6-API\GmailAPI\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php on line 94

Any idea ? Must I activate something on the webserver for TLS ?

  • Does this answer your question? [PHPMailer generates PHP Warning: stream\_socket\_enable\_crypto(): Peer certificate did not match expected](https://stackoverflow.com/questions/30371910/phpmailer-generates-php-warning-stream-socket-enable-crypto-peer-certificate) – Linda Lawton - DaImTo Sep 19 '20 at 16:21
  • Thank you ! It seems to work fine with PHPMailer, don't found yet how to make it work with swift mailer. – Olivier Meunier Sep 20 '20 at 09:16

0 Answers0