Results 1 to 8 of 8

Thread: PHP Auto Reply

  1. #1
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Auto Reply

    I am not getting an Auto reply sent back to the customer (person filling out the form) Any Ideas?

    <?php
    $contact_name = $_POST['name'];
    $contact_email = $_POST['email'];
    $contact_subject = $_POST['subject'];
    $contact_message = $_POST['message'];

    if( $contact_name == true )
    {
    $sender = $contact_email;
    $receiver = "bkindustries@bkindustries.net";
    $client_ip = $_SERVER['REMOTE_ADDR'];
    $email_body = "Name: $contact_name \nEmail: $sender \n\nSubject: $contact_subject \n\nMessage: \n\n$contact_message \n\nIP: $client_ip \n\nContact Sent from http://www.bkindustries.net";
    $extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();

    if( mail( $receiver, "BK Industries - $contact_subject", $email_body, $extra ) )
    {
    echo "success=yes";
    }
    else
    {
    echo "success=no";
    }
    }
    ?>

  2. #2
    Join Date
    Sep 2010
    Location
    Hi Stalker.
    Posts
    148
    Thanks
    16
    Thanked 3 Times in 3 Posts

    Default

    Try something like AllForms, I love it.
    http://allforms.mailjol.net
    When making a form in the basic part, you have that option.

  3. #3
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    At the end write:
    PHP Code:
    else echo "no contact"
    and see if it shows up
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  4. #4
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ...

    Unless I am putting it in wrong that doesn't seem to fix itm any other ideas?

  5. #5
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    It should not, it's a diagnostic tool, what does the page say when a form is submitted to it?
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  6. #6
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 21 Times in 21 Posts

    Default

    $contact_name is not going to equal TRUE, it will equal what was entered in the form. If you are simply looking to make sure something has been entered in the name field then use this.
    PHP Code:
    if (!empty($contact_name
    instead of this.
    PHP Code:
    if( $contact_name == true 

  7. #7
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ...

    You can use the contact us form at bkindustries.net to see it work. It will send the message to me no problem, but it doesn't send the auto reply back to the person who filled out the form.

    The if( $contact_name == true ) is simply checking if it has something there. If that part of the form is empty then it = false, if there is any content in it at all then it = true.

    I will however try it your way to see if it allows the auto reply to send by some fluke, thank you.

    Any other Ideas guys on what might be preventing it from sending? (The way I posted it is IDENTICAL to how it is on the server.

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

    Default

    You didnt set it to send it back to the original person. The reply to only tells the recipient of the mail where to reply back to. Make another mail function that sends a message to the user as well...


    PHP Code:
    $extra2 "From: $receiver\r\n" "Reply-To: $receiver \r\n";
    if( 
    mail$receiver"BK Industries - $contact_subject"$email_body$extra) && mail$sender"Info Received"$email_body$extra2 ) )

    Corrections to my coding/thoughts welcome.

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
  •