2012-07-20 74 views
0

我试图找到一种在Zend中调试电子邮件的同等方式,就像我可以在cakePHP中一样。在发送测试邮件之前,我想看看我的测试结果。我可以将电子邮件发送给我自己,并以这种方式工作,但我觉得这很乏味。Zend电子邮件调试

//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(); 
+1

是这样的:死亡($ MAIL-> getBodyHtml())或死亡(的print_r($电子邮件)) – 2012-07-20 17:16:12

+0

@DirkMcQuickly你能请张贴此作为一个答案,所以我可以接受这是正确的答案? – Stirling 2012-07-31 15:08:13

回答

1

类似:

die($mail->getBodyHtml()); 

die(print_r($mail)); 
0

对于HTML内容,您可以简单的写:

echo $content; exit(); 

而对于纯文本撰写内容:

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