fathernugen Posted January 14, 2011 Share Posted January 14, 2011 <?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. Quote Link to comment https://forums.phpfreaks.com/topic/224424-php-mail-form-send-to-multiple-email-addresses/ Share on other sites More sharing options...
trq Posted January 14, 2011 Share Posted January 14, 2011 Is this because i have written recipient? Should it be recipients? it could be $foo for all php cares. It's just variable name. There is no obvious reason why that code shouldn't work. The $recipient string is valid. Quote Link to comment https://forums.phpfreaks.com/topic/224424-php-mail-form-send-to-multiple-email-addresses/#findComment-1159332 Share on other sites More sharing options...
fathernugen Posted January 14, 2011 Author Share Posted January 14, 2011 OK. When I tested it with two of my own email addresses it worked perfectly. I think it could be a problem with one of the email addresses. I'll try using another email address in it's place to see if that's the problem. Quote Link to comment https://forums.phpfreaks.com/topic/224424-php-mail-form-send-to-multiple-email-addresses/#findComment-1159334 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.