Problem when sending mail with Zend Mail?

Another great thing on Zend_Mail is that's chainable, so you can do this:

$mail = new Zend_Mail();
$mail->setBodyText('My Nice Test Text')
     ->setBodyHtml('My Nice Test Text')
     ->setFrom('[email protected]', 'Mr Example')
     ->addTo('[email protected]', 'Mr Test')
     ->setSubject('TestSubject')
     ->send();

Don't know for sure if 'chainable' is the right word, but I hope you got the point. This is just a free tip. The answer is given (right) by Benjamin


As you can see in the Stack trace Zend_Mail uses Zend_Mail_Transport_Sendmail as transport adapter.
So make sure a sendmail-compatible MTA (e.g. Postfix) is running on your system.

As an alternative you could use the Zend_Mail_Transport_Smtp transport adapter and use an external SMTP-Server like so

$tr = new Zend_Mail_Transport_Smtp('mail.example.com', array(
    'auth'     => 'login',
    'username' => $username,
    'password' => $password,
    'port'     => $port,
));
Zend_Mail::setDefaultTransport($tr);

Edit: For your 2nd Problem: a

require_once('Zend/Mail/Transport/Smtp.php');

should help.