Can a simple php email form be directed
to 2 email addresses and if yes, what would the line
of code be ?
thanks for any help in advance
Can a simple php email form be directed
to 2 email addresses and if yes, what would the line
of code be ?
thanks for any help in advance
You would need to duplicate and edit the mail(); part. If you post the script you have ill reply with the changes you need to have it send to 2 different emails
Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
here is the snippet from the script
//Sending Email to form owner
$mailto = "xxxxx@yyyyyy.com";
$mailsubj = "Feedback from website form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: confirm.html");
?>
much appreciate
I believe the below would work;
//Sending Email to form owner
$mailto = "xxxxx@yyyyyy.com , bbbb@bbbb.com";
$mailsubj = "Feedback from website form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: confirm.html");
?>
Andy
PHP- is a blast!
andy128, This does send 2 emails but only to the first of the 2 addresses
like so: xxxxx@yyyyyy.com , bbbb@bbbb.com
the from field contains: xxxxx@yyyyyy.com , bbbb@bbbb.com
in both emails received.
What I would like is for a single email to be sent to 2 different addresses.
Try this, its a little bit longer but it does what you want..
/Sending Email to form owner
$mailto = "xxxxx@yyyyyy.com";
$mailsubj = "Feedback from website form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
/Sending Email to form owner
$mailto = "aaaaaa@bbbbbbb.com";
$mailsubj = "Feedback from website form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: confirm.html");
?>
John-
I am confused. It should not do as you are saying. I will experiment with it in the am and get back to you.
Please post the script you used so I have someting to use as an example in my test.
Andy
PHP- is a blast!
I beleive its because of the comma placement
Try this
//Sending Email to form owner
$mailto = "xxxxx@yyyyyy.com, bbbb@bbbb.com";
$mailsubj = "Feedback from website form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: confirm.html");
?>
If that doesnt work do this:
//Sending Email to form owner
$mailto_1 = "xxxxx@yyyyyy.com";
$mailto_2 = "qqqqqq@wwwww.com";
$mailsubj = "Feedback from website form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto_1, $mailsubj, $mailbody, $mailhead);
mail($mailto_2, $mailsubj, $mailbody, $mailhead);
header("Location: confirm.html");
?>
If neither work, then... im not sure, perhaps the way the email is formated
Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
There are currently 1 users browsing this thread. (0 members and 1 guests)