horse1970 Posted May 20, 2009 Share Posted May 20, 2009 Im stumped and cant seem to find a solution or example to help so am posting here. I have a web form that collects information from the user and when they submit sends an email to a particular address with a message body. That works fine but i want to send at the same time another email to another recepient with a different body message. I thought i could create another msg and send with this new body message but this then doesnt allow the first messgage to be sent <?php //build the mail message $msg="*******.\r\n"; $msg.="********.\r\n"; $msg.="********.\r\n"; $msg.="******\r\n"; $msg.="Name: ".$_POST["fname"]." ".$_POST["lname"]."\r\n"; $msg.="\r\n"; //set up email for store $recipient="email@domain.com"; $subject="*******"; $mailheaders="From: ********* \r\n"; $mailheaders.="Reply-To: ".$_POST["cemail"]; $to="email@domain.com"; $csubject="*******n"; $headers="From: > \r\n"; //send mail to Customer mail($recipient,$subject,$msg,$mailheaders); $msg1="*******.\r\n"; $msg1.="********.\r\n"; $msg1.="********.\r\n"; $msg1.="******\r\n"; $msg1.="Name: ".$_POST["fname"]." ".$_POST["lname"]."\r\n"; $msg1.="\r\n"; mail($to,$csubject,$msg1,$headers); ?> Quote Link to comment https://forums.phpfreaks.com/topic/158842-multiple-emails-with-different-message-bodys/ Share on other sites More sharing options...
MadTechie Posted May 20, 2009 Share Posted May 20, 2009 check each mail by them selfs i think the first mails header is wrong but you have removed alot so its hard to say try a simple test like this mail('user1@example.com', 'My Subject1', 'hello'); mail('user2@example.com', 'My Subject2', 'world'); but also keep inmind that some hosts block mass mails so you will need to wait a few seconds before sending the next mail! Quote Link to comment https://forums.phpfreaks.com/topic/158842-multiple-emails-with-different-message-bodys/#findComment-837814 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.