Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Nottingham, UK
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sending a confirmation email

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

    http://www.codingforums.com/showthre...5&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
    You are not a human being having a spiritual experience, your a spiritual
    being having a human experience.

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Location
    Nottingham, UK
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    You are not a human being having a spiritual experience, your a spiritual
    being having a human experience.

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    Regular Coder
    Join Date
    Sep 2002
    Location
    Nottingham, UK
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    You are not a human being having a spiritual experience, your a spiritual
    being having a human experience.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •