1

I'm using a third-party email service called SendGrid to send email but am coming up with what I think is a server issue with the SSL. A temporary fix is to edit a line similar to this in a PHPMailer example:

$mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);

But Craft doesn't use anything that resembles that to me.I want to try hacking the core to see if I can get a temporary fix up but can't find where to put it, despite scouring EmailService.php. Can anyone point me to the function where I'd add these details?

Here's the error, by the way:

stream_socket_enable_crypto(): Peer certificate CN=`#################' did not match expected CN=`smtp.sendgrid.net' (/home/################/craft/app/vendor/phpmailer/phpmailer/class.smtp.php:367
  • The file your looking for is './craft/app/vendor/phpmailer/phpmailer/class.phpmailer.php' look for the line with public $SMTPOptions = array(); – Regan Lawton Apr 27 '17 at 7:37
  • Thank you - I'd spent some time in that file but will return to that line. I can't see Craft passing anything to that array, can you? – Clive Portman Apr 27 '17 at 8:36
  • The file is setting defaults that public array is used elsewhere. By setting that array with the info in your question you will prevent the Peer Certificate error your getting. – Regan Lawton Apr 28 '17 at 0:41
2

The fix for the specific error was to switch the port number within email settings to 2525 - that took a lot of finding out, but crucially avoids hacking PHPMailer.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.