Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
基于用户名输入的来自名称标题的php电子邮件_Php_Email - Fatal编程技术网

基于用户名输入的来自名称标题的php电子邮件

基于用户名输入的来自名称标题的php电子邮件,php,email,Php,Email,我做错了什么。当用户提交表单时,它会显示在我的收件箱中,并将其名称作为电子邮件地址,我希望它是他们在表单中输入的名称。这是我的密码 <?php //error_reporting(0); //include("connection.php"); $n=$_POST['name']; $e=$_POST['email']; $p=$_POST['phone']; $t1=$_POST['tot_eth'] ; $t2=$_POST['tot_tax']; $t3=$_POST['tot_ac

我做错了什么。当用户提交表单时,它会显示在我的收件箱中,并将其名称作为电子邮件地址,我希望它是他们在表单中输入的名称。这是我的密码

<?php
//error_reporting(0);
//include("connection.php");
$n=$_POST['name'];
$e=$_POST['email'];
$p=$_POST['phone'];
$t1=$_POST['tot_eth'] ;
$t2=$_POST['tot_tax'];
$t3=$_POST['tot_acct'];
$t4=$_POST['tot_tot'];
$i=1;
while($i<13)
{

${'date' . $i} = $_POST["date$i"] ;
${'seminar'.$i}=$_POST["seminar$i"] ;
${'sponser'.$i}=$_POST["sponser$i"] ;
${'ethics'.$i}=$_POST["ethics$i"] ;
${'tax'.$i}=$_POST["tax$i"] ;
${'acct'.$i}=$_POST["acct$i"] ;
${'t'.$i}=$_POST["total$i"] ;
$i++;
}

//session_start();

$to = "mj@ntatax.com";
$from=$n $e;
$subject = "2015 CPE Verification Form";

// compose headers
$headers = 'From: '. $_POST['name'] . ' <' . $e . '>\r\n' .
'Reply-To:' .$from  . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// compose message
$message ='<html>
           <body>
    <p>
    From Name : '.$n.'<br>
    From Email : '.$e.'<br>
    Phone Number : '.$p.'<br><br>

    </p>
    <table cellpadding="5">  <tr>
<td>Date  </td>
<td>Seminar Attended and Location  </td>
<td>Sponsor  </td>
<td>Ethics Hours  </td>
<td>Tax Hours  </td>
<td>Acct Hours</td>
<td>Total Hours</td>
</tr>
';
for ($i=1;$i<=13;$i++){

$message .='<tr>
<td>'.${'date' . $i}.'</td>
<td>'.${'seminar'.$i}.'</td>
<td>'.${'sponser'.$i}.'</td>
<td>'.${'ethics'.$i}.'</td>
<td>'.${'tax'.$i}.'</td>
<td>'.${'acct'.$i}.'</td>
<td>'.${'t'.$i}.'</td>
</tr>';


}
$message .='  <tr></tr>
<tr>
<td colspan=2>
<td><p style="text-align: right">Total</p></td>
<td>'.$_POST['tot_eth'].'</td>
<td>'.$_POST['tot_tax'].'</td>
<td >'.$_POST['tot_acct'].'</td>
<td >'.$_POST['tot_tot'].'</td> </td>
</tr>  </table>



        </body>
   </html>';

$message = wordwrap($message, 270);

// send email
mail($to,$subject, $message, $headers,"'".'-f '.$from."'");
//  mail($to,$subject, $message, $headers,"'".'-f '.$from."'");
session_start();
//$_SESSION['send1']="Thanks For Contacting Us,Your Query Will Be Replied At the Earliest.";
header("location:http://www.waainc.org");


?>

更改$from=$n$e;至$from=$e;然后$headers='From:'$_张贴['name']\r\n'to$headers='From:'$n.“\r\n停止停止。这段代码很容易被滥用——垃圾邮件发送者可以并且将插入头来使用您的服务器发送垃圾邮件。使用适当的类,如。