Jan
Zend Framework : Sending emails using Zend_Mail and Google Smtp
Sending emails using Zend_Mail component from Zend Framework is an easy as it can get task. On a recent project, i needed to configure Zend_Mail to work with Google Smtp server.
Here is a quick how to:
$settings = array('ssl'=>'ssl', 'port'=>465, 'auth' => 'login', 'username' => 'youremail@gmail.com', 'password' => 'YOUR_PASSWORD'); $transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $settings); $email_from = "YOUR_EMAIL"; $name_from = "YOUR NAME"; $email_to = "TO_EMAIL"; $name_to = "TO NAME"; $mail = new Zend_Mail (); $mail->setReplyTo($email_from, $name_from); $mail->setFrom ($email_from, $name_from); $mail->addTo ($email_to, $name_to); $mail->setSubject ('Testing email using google accounts and Zend_Mail'); $mail->setBodyText ("Email body"); $mail->send($transport);
Don’t even bother to add a different email to $email_from than your Google email, because Google will override your settings by you account email.
Update: Got a tip from Bruno Pedro, Google has smtp sending limits, you can only send up to 500 emails using a Google standard account. Read the Google answer on this limiting issue, for more info.
For a more detailed look, just check out Zend_Mail component page.

