Stirling
Stirling

Reputation: 4378

Zend email debug

I am trying to find an equivalent way to debug an email in Zend like I can in cakePHP. I want to see my test output before I send an email out for testing. I could just send the email to myself, and work bugs out that way, but I find that tedious.

//zend mail
$mail = new Zend_Mail();
$mail->setBodyHTML($content);
$mail->setBodyText($content);
$mail->setFrom('[email protected]', 'Security Notification');
$mail->addTo('[email protected]');
$mail->setSubject('(Security Notify) New Security Request');
//$mail->send();

//Equivalent to this from cakePHP
$this->Email->delivery = 'debug'; 
$this->Email->send('test message'); 
debug($this->Session->read('Message.email'));
die(); 

Upvotes: 1

Views: 2431

Answers (2)

Dirk McQuickly
Dirk McQuickly

Reputation: 2139

something like:

die($mail->getBodyHtml());

or

die(print_r($mail));

Upvotes: 1

Florent Paillot
Florent Paillot

Reputation: 55

For your content in HTML, you can simply write:

echo $content; exit();

And for your content in plain text write:

echo '<pre>' . $content . '</pre>'; exit();

Upvotes: 0

Related Questions