...

View Full Version : Sending a confirmation email



sarah
04-04-2003, 04:15 PM
Hi all, I followed the above method to send emails in php - thanx Habib n Firepages (see link below).

http://www.codingforums.com/showthread.php?s=&threadid=16501&perpage=15&pagenumber=1

I tried posting my query but no one replied because the thread is closed. So I have started a new thread (apologies to Moderators - this is not an attempt to cross post).

I now want to take this one step further. I send an email using the following code:

<? php
if ($products=="yes") {
$to="products@sarah.mydomain.com";
$subject="Product Info you required";
$message.="Hi, blah blah blah.....";
}

if($geninfo=="yes") {
$to="enquiries@sarah.mydomain.com";
$subject="General Enquiry";
$message.="Hi, blah blah blah.....";
}

mail($to, $subject, $message);

At the moment depending on which variable is passed I get the relevant email. I now want to send myself one type of email (i.e using above code), and send the sender a confirmation email - this would have a different subject, body text, etc. (possibly even a HTML email).

What is the best way of doing this?

Sarah

Spookster
04-04-2003, 05:13 PM
Yes I closed that other thread. We frown upon thread hijackings. :)

You want to send an email to yourself but only if the value of a variable is set to a certain value?

sarah
04-04-2003, 07:21 PM
No, using the above code I currently get various emails depending on what the user has requested. I.e if a user requests info about products then a form designed for products passes on the products variable and a product enquiry type email is generated. For different types of queries, different emails are generated and sent to relevant people.

What I want to do now is continue to receive the different emails but also send a generic confirmation email to the sender. I.e if Person A makes a Products enquiry, a Products email is generated and sent to the enquiries people, and at the same time Person A receives an email confirming that there enquiry has been received, and what their query was. This confirmation email would have a different subject heading, different text in the body, different signature. Could also possibly be in HTML.

Make sense?

Spookster
04-04-2003, 08:14 PM
Ok so what you want is that every time there should be two emails sent....one to you and one to your visitor?

but the email that is sent will be based off a variable?

sarah
04-06-2003, 02:24 PM
yes, the variable will be the users email address. In my code, I store the user's email address as $email.

I tried the following code:

file is called email_me.php

if ($order=="yes") {
$to="orders@sarah.mydomain.com";
$subject="Order from Web";
$message="User Details:"."\n"."\n";
$message.="Forename: ".$forename;
$message.="Surname: ".$surname;

// enter the rest of my fields here

and so on....
}

i then created another file called confirmation_email.php

if ($order=="yes") {
$to=.$email;
$subject="Confirmation Email form Sarah.mydomain.com";
$message="Hello ".$forename."\n";
$message.="Thankyou for your order!"."\n";
$message.="Your order is currently being processed"."\n";
$message.="If for some reason there is a problem with your order, we will contact you as soon as possible."."\n"."\n";
$message.=Your order number is: ".$order_no."\n";

//breakdown of order and total costs

}

but I get a parse error on the $to line. So I changed the $to=$email and it works.

Thanks for your help anyway.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum