如何将输入字段中的变量添加到邮件主题?
How to add a variable from input field to the mail subject?
我正在使用联系表单工具从输入表单数据发送电子邮件。
该工具会自动使用文本和输入字段中的数据设置主题 'name'。我想将来自输入 'code' 的数据添加到主题。
设置主题的函数:
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;
}
它不会从代码输入中添加数据。
转到函数:function CollectData(){}
在新行中写入此函数:
$this->code = $this->Sanitize($_POST['code']);
转到 $this->mailer->Subject = "$code $this->code $this->name";
并删除 "$code"
。
最好显示您的所有代码,即使是 copy/paste 来自互联网的代码。它会帮助我们。
我正在使用联系表单工具从输入表单数据发送电子邮件。
该工具会自动使用文本和输入字段中的数据设置主题 'name'。我想将来自输入 'code' 的数据添加到主题。
设置主题的函数:
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;
}
它不会从代码输入中添加数据。
转到函数:
function CollectData(){}
在新行中写入此函数:
$this->code = $this->Sanitize($_POST['code']);
转到
$this->mailer->Subject = "$code $this->code $this->name";
并删除"$code"
。
最好显示您的所有代码,即使是 copy/paste 来自互联网的代码。它会帮助我们。