Jump to content

Mailing Form to multiple recipients


wispas

Recommended Posts

I currently have a mail form that sends to a single email address.

Does anyone know how i can set it up so it sends out to more than one email address. Thanks!

 

The Form

<form method="POST" action="mailer.php">
   <input type="text" name="name" size="19"><br>
   <br>
   <input type="text" name="email" size="19"><br>
   <br>
   <textarea rows="9" name="message" cols="30"></textarea>
   <br>
   <br>
   <input type="submit" value="Submit" name="submit">
</form>

 

Processing PHP

<?php
if(isset($_POST['submit'])) {

$to = "[email protected]";
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];

$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";

echo "Data has been submitted to $to!";
mail($to, $subject, $body);

} else {

echo "blarg!";

}
?>

Link to comment
https://forums.phpfreaks.com/topic/188901-mailing-form-to-multiple-recipients/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.