Sending confirmation email

Hi,

Using the code (below) I receive an email whenever someone downloads a brochure from my website. I would like to send them a “Thank you” confirmation email but, although I’ve spent all weekend working on it, I can’t figure out how to do this (still very much a newbie).

Would you mind having a look through the code and advising, please?

<? $name = $_REQUEST['name'] ; $house = $_REQUEST['house'] ; $road = $_REQUEST['road'] ; $town = $_REQUEST['town'] ; $county = $_REQUEST['county'] ; $postcode = $_REQUEST['postcode'] ; $telephone = $_REQUEST['telephone'] ; $email = $_REQUEST['email'] ; $date = $_REQUEST['date'] ; mail ("[email protected]", "The brochure has been downloaded", "Name: $name, House: $house, Road: $road, Town: $town, County: $county, Postcode: $postcode Telephone: $telephone, Email: $email, Date: $date" ); header( "Location: brochure.php" ); ?>

Many thanks

Tony

Try putting this under the other mail script, it should send an email to the user from you

[php]
$headers = “From: Website Name [email protected]”;
$message = “…”;

mail($email, “Thank You for Downloading Our Brochure”, $message, $headers);
[/php]

however if you want it to only send a “Thank You” to the user if the first email has been sent to you, then you would use :

[php]

<? $name = $_REQUEST['name'] ; $house = $_REQUEST['house'] ; $road = $_REQUEST['road'] ; $town = $_REQUEST['town'] ; $county = $_REQUEST['county'] ; $postcode = $_REQUEST['postcode'] ; $telephone = $_REQUEST['telephone'] ; $email = $_REQUEST['email'] ; $date = $_REQUEST['date'] ; $message = "Name: $name, House: $house, Road: $road, Town: $town, County: $county, Postcode: $postcode Telephone: $telephone, Email: $email, Date: $date" if(mail ("[email protected]", "The brochure has been downloaded", $message)) { $headers = "From: Website Name "; $thanks_message = "..............."; mail($email, "Thank You for Downloading Our Brochure", $message, $headers); } else { //what you would like to do if the confirmation email is not sent to you } header( "Location: brochure.php" ); ?>

[/php]

Just to say thank you to maas for a very consise answer which completely resolved my problem.

Many thanks - I really appreciate your help

Tony

Sponsor our Newsletter | Privacy Policy | Terms of Service