Codeigniter发送多封电子邮件
我在表达式引擎插件中使用codeigniters电子邮件类(EE运行于CI)。 出于某种原因,每次运行插件时,它都会发送2封电子邮件,而不是1封。电子邮件是一样的Codeigniter发送多封电子邮件,codeigniter,email,expressionengine,Codeigniter,Email,Expressionengine,我在表达式引擎插件中使用codeigniters电子邮件类(EE运行于CI)。 出于某种原因,每次运行插件时,它都会发送2封电子邮件,而不是1封。电子邮件是一样的 {exp:cdwd_emailer:questionnaire type="{segment_3}" entry_id="{segment_4}"} 下面是上述函数调用的函数 public function questionnaire() { $type = $this->EE->TMPL->fetch_
{exp:cdwd_emailer:questionnaire type="{segment_3}" entry_id="{segment_4}"}
下面是上述函数调用的函数
public function questionnaire() {
$type = $this->EE->TMPL->fetch_param('type');
$typeLower = str_replace("-", " ", $type);
$typeUpper = ucwords($typeLower);
print_r($type);
$entry_id = $this->EE->TMPL->fetch_param('entry_id');
$subject = $typeUpper.' Questionnaire Submission';
$fromEmail = 'email@email.com';
$fromName = 'Test Name';
$toEmail = 'email@email.com';
$message = '
<p>A new '.$typeLower.' has been submitted.</p>
<p><a href="http://www.domain.co.uk/questionnaires/view/'.$type.'/'.$entry_id.'">Please click here to view this submission</a></p>
';
$this->EE->load->library('email');
$this->EE->email->set_mailtype("html");
$this->EE->email->from($fromEmail, $fromName);
$this->EE->email->to($toEmail);
$this->EE->email->subject($subject);
$this->EE->email->message($message);
$this->EE->email->send();
}
公共职能调查问卷(){
$type=$this->EE->TMPL->fetch_param('type');
$typeLower=str_replace(“-”,“”,$type);
$typeUpper=ucwords($typeLower);
打印(类型);
$entry\u id=$this->EE->TMPL->fetch\u param('entry\u id');
$subject=$typeUpper.‘问卷提交’;
$fromEmail=email@email.com';
$fromName='testname';
$toEmail=email@email.com';
$message='1
已提交新的“$typeLower.”
';
$this->EE->load->library('email');
$this->EE->email->set_mailtype(“html”);
$this->EE->email->from($fromEmail,$fromName);
$this->EE->email->to($toEmail);
$this->EE->email->subject($subject);
$this->EE->email->message($message);
$this->EE->email->send();
}
谁能告诉我为什么?我想不出来。我打印了type和entry_id参数的内容,以检查每个参数只收集了1个
谢谢我想你在发送邮件后必须清除邮件对象。 根据表达式引擎,您必须调用:
ee()->email->clear();
对于您的情况:
$this->EE->email->clear();
谢谢我已经添加了它,但它仍然发送两封电子邮件。在电子邮件发送代码后停止执行(
exit();
)。然后检查您的邮件。当我添加exit()时,它仍会发送两封电子邮件,但也会显示一个空白页而不是模板。然后您必须签入服务器电子邮件队列。