Zend-mail sending email Connection Timed Out error
Question
I am trying to set-up a registration form that sends a welcoming email to the new member. The form works just fine on my localhost, but when trying to upload it to the remote server I get a "Connection Timed Out" error at the top of the page when the submit button is used.
I am using my teacher's remote server so I have only limited access to the server.
$mailhost = 'smtp.gmail.com';
$mailconfig = array('auth' => 'login',
'username' => 'myemail@gmail.com',
'password' => 'xxxxxxxx',
'ssl' => 'ssl',
'port' => '465');
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$mail = new Zend_Mail('UTF-8');
$mail->setBodyText($text, 'UTF-8');
$mail->setBodyHtml($html, 'UTF-8');
$mail->setFrom('myemail@gmail.com', 'from me');
$mail->addTo($email, $name);
$mail->setSubject('Welcome to the page');
$success = $mail->send();
if(!$success) {
$errors = true;
}
Solution
I have found out that my teacher's server blocks smtp which was causing the time out error.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow