i have one contact form, when user submit all value will send(email) to admin.But now i want to do when user submit admin will receive the email and user also will receive an email but with different body.
here my previous code :
<?php
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
$name= $_POST["name"];
$email= $_POST["email"];
$phone= $_POST["phone"];
$company= $_POST["company"];
$message= $_POST["message"];
require_once('lib/class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$mail->AddReplyTo("admin@gmail.com","I Concept");
$mail->SetFrom('admin@gmail.com', 'I Concept');
$mail->AddReplyTo("admin@gmail.com","I Concept");
$address = "admin@gmail.com";
$mail->AddAddress($address, "I Concept");
$mail->Subject = "MY - Request a Quote";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->Body = "<strong>Request a Quote from I Concept Malaysia Website</strong><br><br>
Name : $name<br>
Email : $email<br>
Phone : $phone<br>
Company : $company<br>
Enquiry : $message<br> <br>
Thank You!<br>
";
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!<br>";
}
}
?>
I'm sure you can't send different bodies in one SMTP call. However you can just send the first email and initiate a new PHPMailer.
Cloning the PHPmailer object is not necessary. Just use the ClearAllRecipients method that is built into PHPmailer before changing the body and sending the second email.
Try the following. Didn't test but you basically need to get another
PHPMailer
object going and set thebody
andto
information separately.