php - Unable to connect to gmail smtp using zend -
i trying send email using zend smtp.
i have configured zend , credential of google.
when try send mail getting error.
a connection attempt failed because connected party did not respond after period of time, or established connection failed because connected host has failed respond.
i not sure mistake did. can 1 me out. code.
indexcontroller.php
public function indexaction() { $mail = new zend_mail(); $mail->addto('chaitanya5a2@gmail.com', 'chaitanya kanuri') ->setfrom('chaitanya@gmail.com', 'myself') ->setsubject('my subject') ->setbodytext('email body') ->send(); }
bootstrap.php
class bootstrap extends zend_application_bootstrap_bootstrap { protected function _initdefaultemailtransport() { $emailconfig = $this->getoption('email'); $smtphost = $emailconfig['transportoptionssmtp']['host']; unset($smtphost); $mailtransport = new zend_mail_transport_smtp('smtp.gmail.com', $emailconfig['transportoptionssmtp']); zend_mail::setdefaulttransport($mailtransport); } }
application.ini
email.transportoptionssmtp.host = "smtp.gmail.com" email.transportoptionssmtp.auth = "login" email.transportoptionssmtp.username = "mygmail@gmail.com" email.transportoptionssmtp.password = "mygmailpassword" email.transportoptionssmtp.ssl = "ssl" email.transportoptionssmtp.port = 465
thanks in advance.
Comments
Post a Comment