Results 1 to 5 of 5

Thread: Adding Auto Reply

  1. #1
    Join Date
    Jan 2009
    Location
    Dallas Texas
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Arrow Adding Auto Reply

    Hey everybody - thanks in advance for any assistance you can provide.

    I have this form, and it submits just fine - however, i now need it to send the submitter a copy of the email and some additional information.

    can you PLEASE help me with this?

    Here's the php form code:

    <?php

    $EmailFrom = "Win One";
    $EmailTo = "sales@capsonewire.com";
    $Subject = "Registration";
    $Name = Trim(stripslashes($_POST['Name']));
    $Tel = Trim(stripslashes($_POST['Tel']));
    $Email = Trim(stripslashes($_POST['Email']));
    $Phone = Trim(stripslashes($_POST['Phone']));
    $Message = Trim(stripslashes($_POST['Message']));

    // validation
    $validationOK=true;
    if (!$validationOK) {
    print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    exit;
    }

    // prepare email body text
    $Body = "";
    $Body .= "Name: ";
    $Body .= $Name;
    $Body .= "\n";
    $Body .= "Email: ";
    $Body .= $Email;
    $Body .= "\n";
    $Body .= "Phone: ";
    $Body .= $Phone;
    $Body .= "\n";
    $Body .= "Message: ";
    $Body .= $Message;
    $Body .= "\n";

    // send email
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

    // redirect to success page
    if ($success){
    print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
    }
    else{
    print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    }
    ?>

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Can't you just add another mail function in?

    The PHP header function will work better than the meta redirect as well http://php.net/manual/en/function.header.php
    Corrections to my coding/thoughts welcome.

  3. The Following User Says Thank You to bluewalrus For This Useful Post:

    Hemjesti (08-20-2010)

  4. #3
    Join Date
    Jan 2009
    Location
    Dallas Texas
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    i am not a coder by any means and my boss threw me under the bus to add an auto reply to this form. I've figured out that this is the code that the form uses to process - but now i have NO IDEA what to do. Mail function, header, meta, no idea what all that means....

  5. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Okay, disregard headers and meta info than and try this...


    PHP Code:
    <?php

    $EmailFrom 
    "Win One";
    $EmailTo "sales@capsonewire.com";
    $Subject "Registration";
    $Name Trim(stripslashes($_POST['Name']));
    $Tel Trim(stripslashes($_POST['Tel']));
    $Email Trim(stripslashes($_POST['Email']));
    $Phone Trim(stripslashes($_POST['Phone']));
    $Message Trim(stripslashes($_POST['Message']));

    // validation
    $validationOK=true;
    if (!
    $validationOK) {
    print 
    "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    exit;
    }

    // prepare email body text
    $Body "";
    $Body .= "Name: ";
    $Body .= $Name;
    $Body .= "\n";
    $Body .= "Email: ";
    $Body .= $Email;
    $Body .= "\n";
    $Body .= "Phone: ";
    $Body .= $Phone;
    $Body .= "\n";
    $Body .= "Message: ";
    $Body .= $Message;
    $Body .= "\n";

    // send email
    $success mail($EmailTo$Subject$Body"From: <$EmailFrom>");

    //Auto send
    $Auto_Subject 'Auto_Response';
    $Auto_Body 'Auto filled email';
    $Auto_From 'computer_talks@computer.com';
    if (
    mail($Email$Auto_Subject$Auto_Body"From: <$Auto_From>") {
    echo 
    "sent";
    } else {
    echo 
    "Not";
    }


    // redirect to success page
    if ($success){
    print 
    "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
    }
    else{
    print 
    "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    }
    ?>
    Corrections to my coding/thoughts welcome.

  6. The Following User Says Thank You to bluewalrus For This Useful Post:

    Hemjesti (08-20-2010)

  7. #5
    Join Date
    Jan 2009
    Location
    Dallas Texas
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thanks guys but I was helped by the phenom over at PHP Freaks. they were sooooo fast and helpful and didn't make me feel like the idiot i am when it comes to this stuff. Sorry for wasting your time.

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
  •