Friday, 5 July 2013

error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

Possibly my best post title to date but I got this error trying to send mail from Yii in PHP via a Gmail relay. It all looks a bit esoteric but like many errors, once explained, it all makes sense.

This relates to Gmail having two SSL/TLS ports. 465 is for SSL (i.e. pre-TLS) and port 587 for TLS. For most people, SSL and TLS are used interchangeably but not here! I was trying to relay via 587 and had, what I thought, was TLS enabled. As it happens, the mail extension for Yii didn't actually support TLS (or I have it configured wrongly) and was attempting to negotiate SSL with a TLS-only port. The error means the server doesn't support SSLv3.

I simply changed the config to use port 465 and we are back in business.

Good Yii Config:

 'mail' => array(
           'class' => 'ext.mail.YiiMail',
           'transportType' => 'smtp',
           'transportOptions'=>array(
                  'host'=>'smtp.gmail.com',
                  'encryption'=>'tls',
                  'username'=>'xxx@gmail.com',
                  'password'=>'xxxxxxxxxxxx',
                  'port'=>465,
            ),
            'logging' => true,
            'dryRun' => false
        ),
Post a Comment