0

这是我的代码,我在接收邮件时遇到问题,最多需要 3 个小时。请帮我。

function sendMail($to, $subject, $template, $from,$params,$attachmentFile=array(),$layout='default') {

foreach($params as $key=>$val) {

$this->set("".$key."",$val);

}

$this->Email->sendAs = 'html';

if (is_array($to))

$this->Email->to = $to;

else

$this->Email->to = "<".$to.">";

//$this->Email->to;

$this->Email->subject = $subject;

$this->Email->layout = $layout;

$this->Email->replyTo = "test@gmail.com";

$this->Email->from = "test@gmail.com";

$this->Email->attachments = $attachmentFile;

$this->Email->template = $template; // note no '.ctp'

//echo "<pre>";print_r($this->Email);

//die();

if(!$this->Email->send()) {

return 0;

}

else {

return 1;

}

}
4

1 回答 1

2

电子邮件不是即时的。有时,一封普通的电子邮件会花费相当长的时间。我会检查您正在使用的服务器(无论是 SMTP 服务器还是普通的旧 sendmail),并尝试通过它正常发送邮件,看看需要多长时间才能确保它不是 cakephp 配置问题。

于 2011-08-22T15:18:43.510 回答