douwei3863 2013-09-08 12:06
浏览 50
已采纳

将表单数据发送到我的电子邮件地址和用户输入的地址

Hi I asked this question a year ago but couldnt solve it and am now having another go.

link to the original question:

Send email to address from form input

I need to send the form data from my form to the specified address 'diysoakwells@hotmail.com' and also the email address from the form field which is assigned the variable $emaile. As it is the email arrives at diysoakwells@hotmail.com but not the variable address ($emaile). I cant understand why but it is definitely picking up the form data as it has all the details included in the email when I receive it at diysoakwells@hotmail.com. I basically want a copy of the order sent to the user as well as myself.

<?php
include_once("wsp_captcha.php");

if(WSP_CheckImageCode() != "OK") {
header('location:/form-rejected.php');
die();
}

$subject = 'Order Inquiry';
$jcitems = " <p><b>ORDER:</b></p><p> " . $_POST['jcitems']."<p/>" . "<p><b>Total:</b> $" . $_POST['jctotal']."</p>";
$time = date ("h:i A"); 
$date = date ("l, F jS, Y");
$headers = "MIME-Version: 1.0
";
$headers .= "Content-Type: text/html; charset=ISO-8859-1
";
$headers .= 'From: inquiry@DIYSoakwells.com' . "
" .
'Reply-To: noreply@diysoakwells.com' . "
" .
'X-Mailer: PHP/' . phpversion();
$name = $_POST['name'];
$phone = $_POST['phone'];
$emaile = $_POST['emaile'];
$textbox = $_POST['textbox'];
$to = "diysoakwells@hotmail.com,$emaile";
$text = "<html><body><p>This form was submitted on Your Web Site on 
 $date at
 $time</p><p><b>Message:</b>
$textbox</p><p><b>Customers Email Address:</b> $emaile</p><p><b>Customers Name:</b> $name </p><p><b>Customers Phone Number:</b> $phone </p></html></body>";
$body = $text . $jcitems;
mail($to, $subject, $body, $headers);
Header('Location: ../form-accepted.php');
?>    

Please help if you can I will be monitoring this for the next few days. Open to suggestions/explanations!!!

  • 写回答

1条回答 默认 最新

  • doubi4814 2013-09-08 12:10
    关注
    $to = "diysoakwells@hotmail.com;" . filter_var($emaile, FILTER_VALIDATE_EMAIL);
    

    You may also want to try this....

    $to = "diysoakwells@hotmail.com;<" . filter_var($emaile, FILTER_VALIDATE_EMAIL) . ">";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化