Jump to content

php mail form send to multiple email addresses


fathernugen

Recommended Posts

<?php
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$dropdown = $_POST['dropdown'];
$formcontent=" From: $firstname \n Surname: $lastname \n Email: $email \n Dropdown: $dropdown";
$recipient = "[email protected], [email protected]";
$subject = "Newsletter Sign Up";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
if ( mail($recipient, $subject, $formcontent, $mailheader) ){
header('Location: http://www.sittingspiritually.co.uk/thankyou.php');
} else {
die ("error");
}
?>

 

I have recently created a small snippet of php code for posting mail and it's sweet apart from 1 thing.

 

I have two email addresses in the recipient section. It only sends to the last name in the list.

 

Is this because i have written recipient? Should it be recipients?

 

I need this mail to be delivered to both of the email addresses.

 

I'm sure it's simple for someone with expert knowledge.

 

Thanks in advance for any help.

 

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.