Please help me fix problem on Mac OS, when I type on my windows, It works. I try on my mac, it shows "could not open socket". Everybody could help me.
public function indexAction(){
$mail = new Mail\Message;
$mail->setFrom('[email protected]','Flyoverfly Training');
$mail->addTo('[email protected]','maithanh');
$mail->setSubject('Xác nhận việc phục hồi mật khẩu');
$mail->setBody('maithanh');
$transport = new SmtpTransport;
$option = new SmtpOptions(array(
'name' => 'smtp.gmail.com',
'host' => 'smtp.gmail.com',
'port' => 465,
'connection_class' => 'login',
'connection_config' => array(
'username' => '[email protected]',
'password' => 'mypass',
'ssl' => 'ssl'
)
));
$transport->setOptions($option);
$transport->send($mail);
return new ViewModel;
}
May be a firewall issue. However I'm pretty sure php-openssl doesn't installed/enabled on your OS. Under the hood Zend will call stream_socket_client() in order to connect to remote server. As sending email through gmail requires security layer (SSL/TLS), stream_socket_client() will require open ssl support (ssl://). So you must have ssl support on OS, check:
Or getting the list of supported socket transports:
And here goes some useful links:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With