我的php脚本运行良好,但我想在电子邮件主题中发送发件人地址。请指导我如何操作。
请告诉我,我应该在“$ emailSbuject =”来自$ emailFeild \ r \ n“的新订阅中写一下”;“
这是我的php脚本:
<?php
/* subject and email varialbles*/
$emailSbuject = "New Subscription from $emailFeild\r\n";
$webMaster = 'help@sample.com';
$emailSbuject2 = 'Thank you';
$client = ' $emailFeild\r\n';
/*gathering data variables*/
$emailFeild = $_POST['email'];
// admin message body
$body= <<<EOD
New subscriber is $emailFeild
EOD;
$textMessage = <<<EOD
<p style="margin-left:5px;font-family:Calibri"><img alt="" src="http://www.intaxfin.com/images/Intaxfin_logo.png"></p>
<p style="font-family:Calibri">Thank you for subscribing with us. Somebody will get back to you as soon as possible.</p>
<p style="font-size:x-small;color:#0099FF;font-family:Calibri">This e-mail was automatically sent by Administration Directory and is for your reference. Please do not reply to this e- mail address.<br>
Powered by sample</p>
EOD;
$headers = "From: $emailFeild\r\n";
$header = "From: $noreply@sample.com\nMIME-Version: 1.0\nContent-Type: text/html; charset=utf-8\n";
$success = mail($webMaster,$emailSbuject,$body,$headers);
$success1 = @mail($emailFeild,$emailSbuject2,$textMessage,$header);
/*Result*/
$theResults = <<<EOD
EOD;
echo "$theResults";
header("Location: thankyousubscribe.html");
exit;
?>
答案 0 :(得分:-1)
$emailFeild = $_POST['email'];
$emailSbuject2 = "New Subscription from $emailFeild";
注意:$ client已使用$ emailFeild变量启动,该变量在该行之后启动。请先启动变量,然后再使用它。