Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33

Thread: Confirmation Email PHP Sender

  1. #1
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Confirmation Email PHP Sender

    Hello,
    I am trying to get this form to send a confirmation email to the user saying thank you and some other things but I can not get it to send the email to the user only me. Here is the php code:

    PHP Code:
    <?php

    //print "this is the last record";
        // EDIT THE 2 LINES BELOW AS REQUIRED
        
    $email_to "info@mywebsite.com";
        
    $email_subject "Registration";
         
             
    $email_message .= "First Name Entered: ".$_GET["fname"]."\n";
             
    $email_message .= "Last Name Entered: ".$_GET["lname"]."\n";
             
    $email_message .= "Email Entered: ".$_GET["email"]."\n";
              
    $email_message .= "Invitation Code: ".$_GET["email1"]."\n";
     
      
    $ip=$_SERVER['REMOTE_ADDR'];


         
    $email_message .= "IP ADDRESS: "$ip."\n";
    $ip=$_ENV['REMOTE_ADDR'];




         
         
    // create email headers
    $headers 'From: '.$_GET["email"]."\r\n".
    'Reply-To: '.$_GET["email"]."\r\n" .
    'X-Mailer: PHP/' phpversion();
    @
    mail($email_to$email_subject$email_message$headers); 

    //NEW\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    //Create the variables to be used in the mail
        
    $to=$_POST['email'];
        
    $subject="Email Confirmation";
        
    $message="This is a confirmation email";
    //Use the mail function to send the confirmation email
        
    mail($to,$subject,$message); 

    //print $_GET["email"];
    //print "it worked";
    die();


    ?>
    Thank you
    Last edited by itskater; 08-29-2013 at 10:23 PM.

  2. #2
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I have since changed the code to:

    PHP Code:
    <?php


        $email_to 
    "info@codeevents.com";
        
    $email_subject "VIP Member Registration";
         
             
    $email_message .= "First Name Entered: ".$_GET["fname"]."\n";
             
             
    $email_message .= "Last Name Entered: ".$_GET["lname"]."\n";
             
             
    $email_message .= "Email Entered: ".$_GET["email"]."\n";
             
              
    $email_message .= "Invitation Code: ".$_GET["email1"]."\n";
     
          
    $ip=$_SERVER['REMOTE_ADDR'];

        
    $email_message .= "IP ADDRESS: "$ip."\n";
         
        
    $ip=$_ENV['REMOTE_ADDR'];

        
    $to=$_POST['email'];

        
    $subject="Email Confirmation";
        
        
    $message="This is a confirmation email";
        
        
    $subject .= "Test Email"."\n";
        
        
    $email .= "Email Entered: ".$_GET["email"]."\n";

        
    $sendto $_POST['email']."\n";


         
         
    //email headers
    $headers 'From: '.$_GET["email"]."\r\n".
    'Reply-To: '.$_GET["email"]."\r\n" .
    'X-Mailer: PHP/' phpversion();


    @
    mail($email_to$email_subject$email_message$headers); 


    @
    mail($sendto$subject$message);


    die();


    ?>

  3. #3
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Any help please.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Can you explain a little more about this?

    1. Have you looked at various tutorials available around the internet? They can guide you through this step by step.

    2. Do you know PHP fairly well? It looks to me like this is just a matter of lining up the variables in the right places. When you see PHP, does it look like a foreign, unapproachable language? Do you want help with the basics? Or is this problem more complicated than I'm seeing? Do you know how to, for example, set $x=$y, so that you could copy one value to a new one?

    3. a) Who receives the email now?
    b) Who do you want to receive the email instead?
    c) How do you want to determine that value?
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 20 Times in 20 Posts

    Default

    This line is a issue.
    PHP Code:
    $sendto $_POST['email']."\n"
    You are using $_GET on all other vars but this one, plus you are adding on the \n which will not be valid for a email address.
    You never know everything, I learn everyday!

  6. #6
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation PHP Contact Form Confirmation Email?

    Hello,
    I am trying to make this contact form send an confirmation email to the user just saying thank you for registering. I have tried several ways and can not get it to work. It always sends me an email but nothing to the users email.

    This is the PHP sender file code I have been trying to set up:

    PHP Code:
    <?php


        $email_to 
    "info@mywebsite.com";
        
    $email_subject "Registration";
         
             
    $email_message .= "First Name Entered: ".$_GET["fname"]."\n";

        

        

     
             
    $email_message .= "Last Name Entered: ".$_GET["lname"]."\n";

        

        

     
             
    $email_message .= "Email Entered: ".$_GET["email"]."\n";

        

        

     
              
    $email_message .= "Invitation Code: ".$_GET["email1"]."\n";
     
      

        

    $ip=$_SERVER['REMOTE_ADDR'];

        
    $email_message .= "IP ADDRESS: "$ip."\n";

        

     

        

    $ip=$_ENV['REMOTE_ADDR'];

        

    $to=$_POST['email'];

        
    $subject="Email Confirmation";

        


        
    $message="This is a confirmation email";

        


        

    $subject .= "Test Email"."\n";

        


        

    $email .= "Email Entered: ".$_GET["email"]."\n";

        

    $sendto $_POST['email']."\n";


         
         
    //email headers
    $headers 'From: '.$_GET["email"]."\r\n".
    'Reply-To: '.$_GET["email"]."\r\n" .
    'X-Mailer: PHP/' phpversion();


    @
    mail($email_to$email_subject$email_message$headers); 


    @
    mail($sendto$subject$message);


    die();


    ?>
    Thank you
    Last edited by james438; 08-29-2013 at 09:15 PM. Reason: typo; merged here

  7. #7
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 20 Times in 20 Posts

    Default

    did you even read my last post?
    You never know everything, I learn everyday!

  8. #8
    Join Date
    Aug 2013
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello Fastsol1 and Djr33,

    I have tried your advice without any luck. I changed the code from POST to GET but it still does the same thing. It will send me the info perfectly how I want it to but the confirmation email does not send at all. I have been looking up tutorials and trying them all without luck. All I want is the email that is entered into the field to be sent an email from me that says thank you for registering.

    Here is the current code:

    PHP Code:
    <?php


        $email_to 
    "info@mywebsite.com";
        
    $email_subject "Registration";
         
             
    $email_message .= "First Name Entered: ".$_GET["fname"]."\n";
             
             
    $email_message .= "Last Name Entered: ".$_GET["lname"]."\n";
             
             
    $email_message .= "Email Entered: ".$_GET["email"]."\n";
             
              
    $email_message .= "Invitation Code: ".$_GET["email1"]."\n";
     
          
    $ip=$_SERVER['REMOTE_ADDR'];

        
    $email_message .= "IP ADDRESS: "$ip."\n";
         
        
    $ip=$_ENV['REMOTE_ADDR'];

        
    $to=$_POST['email'];

        
    $subject="Email Confirmation";
        
        
    $message="This is a confirmation email";
        
        
    $subject .= "Test Email"."\n";
        
        
    $email .= "Email Entered: ".$_GET["email"]."\n";

        
    $sendto $_GET['email'];


         
         
    //email headers
    $headers 'From: '.$_GET["email"]."\r\n".
    'Reply-To: '.$_GET["email"]."\r\n" .
    'X-Mailer: PHP/' phpversion();


    @
    mail($email_to$email_subject$email_message$headers); 


    @
    mail($sendto$subject$message);


    die();


    ?>

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Please refer back to my previous message and the questions there. It's very difficult to help someone when it requires a lot of guessing from us about what's actually going on.

    What I would recommend, if this is intended as a learning experience, would be creating a new, blank document and retyping everything-- go through each line to see what it does and if it is necessary and whether anything is incorrect. The result will be cleaner.
    If, on the other hand, you just want something that works, I'd suggest looking for a tutorial with working code (there are some out there) and starting from that. This has some confusing issues of what variable is used when (some don't seem to be doing anything).

    Another idea: print this out and draw arrows to see where all of the text is going.

    And another: print out (using 'echo') all of the information going into mail().

    And: turn off the error suppression (@) before the mail() function. If you get an error, that's a good thing-- you should see what it says. You *might* want to turn it back on if you might be getting bad input from users later (though there are probably better ways to handle that).
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  10. #10
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 517 Times in 503 Posts
    Blog Entries
    5

    Default

    Generally speaking, this is very straightforward:

    1. find the name of the form field where the user enters their email
    2. validate that the value in it is a single, valid email address
    3. put that value in the first param of the mail function.

    If you're having as much trouble as you say, I would suggest following Daniel's advice and starting over with a "clean slate." This way, you can eliminate any minor problems that might exist from previous (nonworking) attempts to fix it, and your code will be easier for you to understand and follow.

Similar Threads

  1. Email Auto-Confirmation
    By misslilly1991 in forum PHP
    Replies: 0
    Last Post: 11-08-2011, 10:42 PM
  2. Adding a confirmation email?
    By Bengal313 in forum PHP
    Replies: 2
    Last Post: 08-05-2010, 06:53 PM
  3. php email confirmation...
    By lirhahs in forum PHP
    Replies: 15
    Last Post: 06-10-2010, 09:27 AM
  4. Simple Email Confirmation/OR cc form
    By almcaffee in forum JavaScript
    Replies: 2
    Last Post: 12-08-2009, 01:27 PM
  5. Sending email confirmation
    By Tayfun in forum PHP
    Replies: 4
    Last Post: 08-12-2009, 08:37 PM

Bookmarks

Posting Permissions

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