0

In PHP, I am getting this error while sending email:

"fsockopen() [function.fsockopen]: unable to connect to tls://smtp.gmail.com:465 (Connection timed out)".

Can anyone help me to dynamically load openssl.ddl extention through .htaccess file or any other means other than dl().

I am working with Yii and this is how my main.php is:

'mail' => array(
            'class' => 'application.extensions.yii-mail.YiiMail',
            'transportType'=>'smtp', /// case sensitive!
            'transportOptions'=>array(
                //'host'=>$smtp_host,
                'host'=>'smtp.gmail.com',
                //'username'=>$smtp_username,
            'username'=>'[email protected]',
                //'password'=>$smtp_password,
                'password'=>'testtest10',
            //'port'=>'543',
            'port'=>'465',
            'encryption'=>'tls',
            //'encryption'=>'ssl',
                ),
            'viewPath' => 'application.views.mail',
            'logging' => true,
            'dryRun' => false
        ),  

can anyone please let me know where I am wrong....

2
  • 2
    Connection timed out is not the error you'd get if the openssl module wasn't loaded, it would be something like Unable to find the socket transport "tls" - did you forget to enable it when you configured PHP? I'm guessing you have a firewall blocking you. Commented Jul 23, 2013 at 15:16
  • From the same server where your PHP script is running, can you try to open a telnet connection to smtp.gmail.com on port 465? This should tell you whether or not something is blocking this connection from your server. Commented Jul 23, 2013 at 16:22

1 Answer 1

1

I solved my problem. Actually this configuration was working in localhost but was giving error in server. Had to change settings to work in server. Changed host value to localhost and changed the username and password to same as in server settings. It is working now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.