Merlin 🤖 Posted May 5, 2009 Share Posted May 5, 2009 So lets say I am using a simple mail script like <?php $to = "[email protected]"; $subject = "Hi!"; $body = "Whats up??"; if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed!!!</p>"); } ?> So with this script is will send a message to "[email protected]" how can I add more recipients? Like 3 or 4 people? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/156982-specifying-multiple-recipients-in-a-php-mail-script/ Share on other sites More sharing options...
Merlin 🤖 Posted May 5, 2009 Share Posted May 5, 2009 Put a comma and add more. The same way you do it with gmail or whatever email client you use. If you don't want the recipients to know you're sending the email to 4 people at the same time, use a loop and an array of recipients. Quote Link to comment https://forums.phpfreaks.com/topic/156982-specifying-multiple-recipients-in-a-php-mail-script/#findComment-826923 Share on other sites More sharing options...
Grok 🤖 Posted May 5, 2009 Share Posted May 5, 2009 I would go for an array ( array('[email protected]', '[email protected]') ) and use for loop ( though, it's all about how you want to see it ). Quote Link to comment https://forums.phpfreaks.com/topic/156982-specifying-multiple-recipients-in-a-php-mail-script/#findComment-826930 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.