When I try to send an email from my domain (VPS) through SMTP, PHPMailer (in this case, but it can be any script) shows me the following error:
CLIENT -> SERVER: EHLO www.site.com
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
Warning: stream_socket_enable_crypto(): Unable to locate peer certificate CN in /home/user/site.com/phpmailer/class.smtp.php on line 369
SMTP Error: Could not connect to SMTP host.
CLIENT -> SERVER: QUIT
SERVER -> CLIENT:
SMTP ERROR: QUIT command failed:
SMTP connect() failed.
My PHPMailer has the following:
$mail->IsSMTP(); // Use SMTP
$mail->Host = “sub3.mail.dreamhost.com”;
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPSecure = “tls”; //Secure conection
But still fails.
Apparently DreamHost Let’s Encrypt certificates don’t work with PHP 5.6 or something is going rotten with the VPS setup + Let’s Encrypt to send emails through SMTP.
I can avoid using SSL to send emails through SMTP, but they end up in the SPAM folder and appear as non certificated on gmail and outlook.
Please advice what should I do. I’ve tried everything.
I’m writing this here because I tried support several times but they just kick the ball around and offer no help (funny how I came to dreamhost because I used to say the same from other hosts and now…well…I guess it was a matter of time).