php mail
Posted: Mon Dec 08, 2008 4:27 pm
Hi,
When a user enquires about a product, I want 1 email to be sent to the seller with the below information attached to the email ($recipient, $subject, $body, $headers), but I also want an invoice style email to be sent to the buyer with slightly different content in the $body. How do I send emails to 2 different people with different $body content?
Thanks
<?php
$recipient = "email@domain.com";
$product = $_POST['product'];
$model = $_POST['model'];
$code = $_POST['code'];
$price = $_POST['price'];
$productID = $_POST['productID'];
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$enquiry = $_POST['enquiry'];
$subject = "Website Enquiry about $model";
$body = "
Product Details: \n
Product Brand: \t $product \n
Product Model: \t $model \n
Product Code: \t $code \n
Product ID: \t $productID \n\n
Personal Details: \n
Name: \t $name \n
Email:\t $email \n
Phone:\t $phone \n
Enquiry:\n
$enquiry
";
$headers = "From: $email \n";
$mailSent = mail($recipient, $subject, $body, $headers);
if (!$mailSent) {
header("Location:product_detail.php?id=".$productID."&status=There was an issue sending your enquiry. Sorry");
} else {
header("Location:product_detail.php?id=".$productID."&status=".$model." has been successfully been enquired about");
}
?>
When a user enquires about a product, I want 1 email to be sent to the seller with the below information attached to the email ($recipient, $subject, $body, $headers), but I also want an invoice style email to be sent to the buyer with slightly different content in the $body. How do I send emails to 2 different people with different $body content?
Thanks
<?php
$recipient = "email@domain.com";
$product = $_POST['product'];
$model = $_POST['model'];
$code = $_POST['code'];
$price = $_POST['price'];
$productID = $_POST['productID'];
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$enquiry = $_POST['enquiry'];
$subject = "Website Enquiry about $model";
$body = "
Product Details: \n
Product Brand: \t $product \n
Product Model: \t $model \n
Product Code: \t $code \n
Product ID: \t $productID \n\n
Personal Details: \n
Name: \t $name \n
Email:\t $email \n
Phone:\t $phone \n
Enquiry:\n
$enquiry
";
$headers = "From: $email \n";
$mailSent = mail($recipient, $subject, $body, $headers);
if (!$mailSent) {
header("Location:product_detail.php?id=".$productID."&status=There was an issue sending your enquiry. Sorry");
} else {
header("Location:product_detail.php?id=".$productID."&status=".$model." has been successfully been enquired about");
}
?>