Sending emails with Zend_Mail Print

  • 26

If you are trying to send emails with Zend_Mail, we recommend that you do it in a way so that Zend_Mail uses the mail() function (instead of delivering the message over SMTP).

To do this, just setup Zend_Mail and send the message without specifying a transport. Here is an example:

<?php

require_once 'Zend/Mail.php';

$mail = new Zend_Mail();

$mail->setBodyText('This is the text of the mail.');

$mail->setFrom('[email protected]', 'ServerGrove');

$mail->addTo('[email protected]', 'Your name');

$mail->setSubject('Zend Framework Test');

$mail->send();

print "ok";


 


Was this answer helpful?

« Back