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
    New to the CF scene
    Join Date
    May 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question PHP Email Form - How to implement auto reply?

    Hi I have very little PHP knowledge (this is my first PHP creation).

    I have managed to create a contact form that emails me the data but I want to implement an auto response email. The message I want in the auto response email is:

    Code:
    We have received your DevAndCo Minecraft Server Application and will be reviewing it shortly. One of the DevAndCo team members will be in touch with you as soon as possible. Your submitted application is as follows (if you see any errors please reply to this message to alert us): 
    \n \n \n \n From: $fname \n\n Email Address: $email \n\n Age: $age \n\n Country: $country \n\n About: $about \n\n Image Links: $images
    My code to send the form data to my email currently works so there is no problem with that, but as I say, I want to implement auto response. The PHP handling code to send it to my email is below.

    Code:
    <?php
    
    // Email Subject
    $subject ="DevAndCo Application"; 
    
    // Email Body
    $message="From: $fname \n\n Email Address: $email \n\n Age: $age \n\n Country: $country \n\n About: $about \n\n Image Links: $images";
    
    // Email of Sender
    $mail_from="$email"; 
    
    // From 
    $header="from: $fname <$mail_from>";
    
    // Send to DevAndCo
    $to ='info@devandco.co.uk';
    $send_contact=mail($to,$subject,$message,$header);
    
    // Success page redirect
    // Redirect to success page
    if($send_contact){
    echo "<script>window.location = 'http://www.devandco.co.uk/success.html'</script>";
    }
    else {
    echo "ERROR";
    }
    ?>
    Thanks to anyone who can help me

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,474
    Thanks
    63
    Thanked 537 Times in 524 Posts
    I think in your case you would be better off sending two emails directly from your script - one being your email that goes to you and the second being sent to the member.

    If you want to setup an actual auto responder from the mailbox you're opening a can of worms because not only will you need piping enabled (linux only or on windows a custom mail server that allows custom actions) you'd also need to be able to parse the incoming message to get its details before sending an auto reply.

    Some systems allow you to manually setup an auto reply and if your website supports that, you'd be better off doing that and using a dedicated email account purely for that purpose.
    I can't really think of anything to write here now...

  • #3
    New to the CF scene
    Join Date
    May 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, maybe it doesn't need to have the reply to this email line. Can I just send an email to the sender saying thanks for the application and say what they submitted?

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,474
    Thanks
    63
    Thanked 537 Times in 524 Posts
    Quote Originally Posted by jontysymonds View Post
    Can I just send an email to the sender saying thanks for the application and say what they submitted?
    That would be the second email I was talking about so yes, yes you can

    Also you don't need to use \n\n in your email string.. you can do this instead:
    PHP Code:
    $Spread "text
    over

    multiple
    lines"

    That way it's a bit clearer for you to read but the newline character is preserved and used the same way in your emails.
    I can't really think of anything to write here now...

  • #5
    New to the CF scene
    Join Date
    May 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As I don't know how to do this (I've attempted to do that already but it didn't work for me so obviously I'm doing something wrong) would you be able to adapt my PHP to send the second email?

    I would really appreciate it if you could


  •  

    Tags for this Thread

    Posting Permissions

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