2012-07-20 81 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();