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 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办