Свежайшие Пирожки от CakePHP по-русски

Полнейшее руководство CakePHP 1.2 на русском языке, горячие новости и полезные статьи

Sending A Message Using SMTP

To send an email using an SMTP server, the steps are similar to sending a basic message. Set the delivery method to smtp and assign any options to the Email object's smtpOptions property. You may also retrieve SMTP errors generated during the session by reading the smtpError property of the component.

Простой текст
  1. /* SMTP Options */
  2. $this->Email->smtpOptions = array(
  3. 'port'=>'25',
  4. 'timeout'=>'30',
  5. 'host' => 'your.smtp.server',
  6. 'username'=>'your_smtp_username',
  7. 'password'=>'your_smtp_password');
  8. /* Set delivery method */
  9. $this->Email->delivery = 'smtp';
  10. /* Do not pass any args to send() */
  11. $this->Email->send();
  12. /* Check for SMTP errors. */
  13. $this->set('smtp-errors', $this->Email->smtpError);

If your SMTP server requires authentication, be sure to specify the username and password parameters for smtpOptions as shown in the example.