【发布时间】:2015-05-28 08:05:20
【问题描述】:
我正在使用联系表单工具从输入表单数据发送电子邮件。
该工具会使用文本和输入字段“名称”中的数据自动设置主题。我想将输入“代码”中的数据添加到主题中。
设置主题的函数:
function SendFormSubmission()
{
$this->CollectConditionalReceipients();
$this->mailer->CharSet = 'utf-8';
$this->mailer->Subject = "$code $this->code $this->name";
$this->mailer->From = $this->GetFromAddress();
$this->mailer->FromName = $this->name;
$this->mailer->AddSubject= $this->code;
$this->mailer->AddReplyTo($this->email);
$message = $this->ComposeFormtoEmail();
$textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
$this->mailer->AltBody = @html_entity_decode($textMsg,ENT_QUOTES,"UTF-8");
$this->mailer->MsgHTML($message);
$this->AttachFiles();
if(!$this->mailer->Send())
{
$this->add_error("Failed sending email!");
return false;
}
return true;
}
它不会从代码输入中添加数据。
【问题讨论】:
-
请显示更多代码。你在哪里设置
$code和$this->code? -
整个项目都在这里:ide.c9.io/rokas_m/contactform_php 我是这样设置的:function GetCode() { return $this->code; }
-
需要登录和注册。
-
你能告诉我应该如何设置$code吗?我有
-
您可能想从找出 $code 或 $this -> 代码是否有任何内容开始。试试简单的
print $code看看里面有没有东西。
标签: php email variables phpmailer