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 protected]"; $subject="*******"; $mailheaders="From: ********* \r\n"; $mailheaders.="Reply-To: ".$_POST["cemail"]; $to="[email protected]"; $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); ?> 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('[email protected]', 'My Subject1', 'hello'); mail('[email protected]', '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! 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
Archived
This topic is now archived and is closed to further replies.