我有以下php邮件文件:
<?php $name = $_POST['name'];
$email = $_POST['email'];
$choice = $_POST['choice'];$num = $_POST['num'];
$choice1 = $_POST['choice1'];$num1 = $_POST['num1'];
$phone= $_POST['phone'];
$town= $_POST['town'];
$formcontent="
Name: $name \n
Number: $phone \n
Choice: $choice Amount:$num
Choice: $choice1 Amount:$num1
Town: $town \n
Email: $email" ;
$recipient = "info@domain.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";?>我可以将$email添加到收件人吗?我想将表单中输入的电子邮件添加到接收电子邮件的收件人中。(电子邮件和在表单($email =$_POST‘info@domain.com’;)中输入的电子邮件将收到电子邮件。
发布于 2013-01-10 02:01:24
您可以向$recipient添加多个电子邮件地址,用逗号分隔。尝尝这个。
$recipient = "info@domain.com, $email";编辑
这就是整件事。
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$choice = $_POST['choice']; $num = $_POST['num'];
$choice1 = $_POST['choice1']; $num1 = $_POST['num1'];
$phone= $_POST['phone'];
$town= $_POST['town'];
$formcontent = "
Name: $name \n
Number: $phone \n
Choice: $choice Amount:$num
Choice: $choice1 Amount:$num1
Town: $town \n
Email: $email";
$recipient = "info@domain.com, $email";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank you";
?>https://stackoverflow.com/questions/14243307
复制相似问题