我试图在提交表单时发送多个电子邮件地址,但它只发送一个。这是代码。
$email_to = $_POST['emailto'];
$message = stripslashes($message);
$respond = $_REQUEST['first_name'] ;
mail("$email_to,","Website",$message,"From: $respond","Employment Application");
我试图在提交表单时发送多个电子邮件地址,但它只发送一个。这是代码。
$email_to = $_POST['emailto'];
$message = stripslashes($message);
$respond = $_REQUEST['first_name'] ;
mail("$email_to,","Website",$message,"From: $respond","Employment Application");
这看起来像PHP,你的表单中是否有多个“emailto”字段,或者“emailto”是否有多个电子邮件地址?
我建议您(根据您的表单设计)使用单个输入字段作为电子邮件由一致分隔符(昏迷,分号等)分隔的“emailto”,然后根据请求的格式mail()正在等待。 textarea是这种类型条目的常用输入字段。
我也不明白你为什么最终昏迷。
看一看
http://php.net/manual/en/function.mail.php
,并确保您的地址符合RFC 2822(只需一个
的var_dump($ _ POST [ 'emailto']) ;
) 我很好ering about the additional comma $ email_to --->,< ----
在HTML: <input type="text" name="emailto[]" size=20>
你的PHP代码:
` $ array_email_to = $ _ POST [ 'emailto'];
的foreach($ array_email_to为$ EMAIL_TO){
$消息=的stripslashes($消息);
$ respond = $ _REQUEST ['first_name'];
mail($ email_to,“Website”,$ message,“From:$ respond”,“Employment Application”);
}`
你能告诉我们表单的HTML吗? – ircmaxell 2010-08-31 16:50:05
我希望你明白,如果没有保护,这种形式将立即开始被sparse使用 – 2010-08-31 16:58:57