Home > database >  Problem with SMTP on my VPS with Laravel 9
Problem with SMTP on my VPS with Laravel 9

Time:06-13

I have a problem with SMTP on my Virtual Private Server with Laravel 9.

Here is an error message:

Unable to connect with STARTTLS: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed"

And my SMTP settings on .env file:

MAIL_MAILER=smtp
MAIL_HOST=smtp.i4ware.fi
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

What it the problem. Can anyone help me?

I have Ubuntu Server 20.04 LTS.

CodePudding user response:

You can use cerbot to get ssl certification

https://www.inmotionhosting.com/support/website/ssl/lets-encrypt-ssl-ubuntu-with-certbot/

Or you can diable ssl verification

Editor's note: disabling SSL verification has security implications. Without verification of the authenticity of SSL/HTTPS connections, a malicious attacker can impersonate a trusted endpoint such as Gmail, and you'll be vulnerable to a Man-in-the-Middle Attack.

Be sure you fully understand the security issues before using this as a solution.

You can add below code in /config/mail.php

'stream' => [
   'ssl' => [
      'allow_self_signed' => true,
      'verify_peer' => false,
      'verify_peer_name' => false,
   ],
],
  • Related