Posted on | April 4, 2012 | 1 Comment
It may be that your server does not allow you to send emails, for example a shared server or localhost that you cannot configure.
In either case, if you are using the Zend Framework’s Zend_Mail component, you can have your application send the emails through GMail.
In your application.ini file, add the following:
email.server = smtp.gmail.com
email.username = username
email.password = password
email.ssl = ssl
email.port = 465
Obviously substituting ‘username’ and ‘password’ for your username and password.
In your bootstrap file, add the following _init function.
$this->_aMailConfig = array(
‘auth’ => ‘login’,
‘username’ => $aConfig[’email’][‘username’],
‘password’ => $aConfig[’email’][‘password’],
‘ssl’ => $aConfig[’email’][‘ssl’],
‘port’ => $aConfig[’email’][‘port’]);
$this->_strSmtp = $aConfig[’email’][‘server’];
Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Smtp($this->_strSmtp, $this->_aMailConfig));
You do not need to call this function, your Zend Framework application will call every _init* function in your bootstrap file.
Every email that is sent using the Zend_Mail component will now go through your gmail account. Happy Zending =)
Posted By:Richard Parnaby-King