How to send 2 different messages from 1 form.
Posted: Sun Apr 11, 2010 2:13 pm
Code: Select all
<?php
$your_name = $_POST['your_name'];
$friend_name = $_POST['friend_name'];
$your_email = $_POST['your_email'];
$friend_email = $_POST['friend_email'];
$personal_message = $_POST['personal_message'];
$to = $friend_email;
$subject = 'Your Friend ' . $your_name . 'sends you an e-mail';
$msg = "Hello Mr. XYZ\n" .
"This is the message 1 - $personal_message";
mail($to, $subject, $msg, 'From:' . $your_email);
$to1 = 'abc@yahoo.com';
$subject1 = 'I guess there is one more E-Advocate';
$msg1 = "Hi Mr. ABC, This is message 2-\n" .
"Name - $your_name\n" .
"E-Mail - $your_email\n" .
"The Reciever's/Recievers' Name/Names - $friend_name\n" .
"The Reciever's/Recievers' E-Mail/E-Mails - $friend_email\n" .
"\n";
mail($to1 , $subject1, $msg1, 'From:' . $your_email);
echo '<h2>Thank You ' . $your_name . '. Your Message has Been Sent.</h2><br />';
echo 'We conveyed your friend/friends -' . $friend_name . ' about our mission and that you are supporting it. <br />';
echo 'We also told him/her/them that - "' . $personal_message . '" <br 1/>';
echo 'Thanks a lot from The Akshaya Patra Foundation <br />';
?>