Jump to content

Multiple Emails with different Message Bodys


horse1970

Recommended Posts

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);

?>

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!

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.