[英]CakePHP email not working properly - how to track the error
我使用cakephp電子郵件組件。 在我的實時服務器中,$ this-> Email-> send()返回成功。 但郵件未收到。 問題是什么?? 我需要找出錯誤所在? 我的控制器沒有任何型號,這可能會對電子郵件造成任何問題?
$this->Email->from = 'Mysitename <no-reply@mysite.com';
$this->Email->to = 'sample@gmail.com';
$this->Email->subject = "This is test";
$this->Email->template = 'template_name';
$this->Email->sendAs = 'html';
ob_start();
if($this->Email->send())
{
$this->log(' Mail Success');
}
else
{
$this->log('Something broke in mail');
}
ob_end_clean();
您可以將傳遞設置為調試以查看消息的輸出,以確保一切正常:
$this->Email->delivery = 'smtp';
而且您還需要setFlash('email')來在視圖中查看輸出:
echo $this->Session->flash('email');
就從實時服務器發送電子郵件而言-服務器或IP很有可能被列入黑名單,並且您需要使它通過各種檢查才能接收發送的消息:
http://www.digitalsanctuary.com/tech-blog/debian/setting-up-spf-senderid-domain-keys-and-dkim.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.