Jump to content

php form emailer help


ant

Recommended Posts

Hi everyone!

 

I wrote this form emailer, but I keep getting an error when I try to use it. Here is the error:

 

Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\Hosting\5775271\html\contact.php on line 114

Thank you for contacting us. We will respond as soon as possible.

 

And here is my code. (Line 114 is $send_info = mail($to, $subject, $cust_response);  ):

 

<?php

if (isset($_REQUEST['email']))

//if "email" is filled out, send email

  {

  //send email

  $first_name = $_REQUEST['first_name'] ;

  $last_name = $_REQUEST['last_name'] ;

  $email = $_REQUEST['email'] ;

  $organization = $_REQUEST['organization'] ;

  $phone = $_REQUEST['phone'] ;

  $address1 = $_REQUEST['address_1'] ;

  $address2 = $_REQUEST['address_2'] ;

  $city = $_REQUEST['city'] ;

  $state = $_REQUEST['state'] ;

  $zip = $_REQUEST['zip'] ;

  $message = $_REQUEST['comment'] ;

  $to = "[email protected]";

  $cust_response = "First Name: ".$first_name." Last Name: ".$last_name." Organization: ".$organization."\nEmail: ".$email." Phone: ".$phone." \nAddress 1: ".$address1." \nAddress 2: ".$address2."\nCity: ".$city." State: ".$state." Zip: ".$zip."\nMessage: ".$message;

  $subject = "Customer Request";

 

  $send_info = mail($to, $subject, $cust_response);

 

  echo 'Thank you for contacting us. We will respond as soon as possible.';

  }

else    //if email is not filled out, display the form

  {

 

    echo '<form id="form1" name="form1" method="post" action="contact.php">

      <p>

        <label for="first_name">First Name:</label>

        <br />

<input type="text" name="first_name" id="first_name" />

        <label for="last_name"><br />

        Last Name:</label>

        <br />

<input type="text" name="last_name" id="last_name" />

      </p>

      <p>

        <label for="organization">Organization:</label>

        <br />

<input type="text" name="organization" id="organization" />

        <br />

<label for="phone">Telephone:</label>

<br />

<input type="text" name="phone" id="phone" />

<label for="email"><br />

  Email:</label>

        <br />

        <input type="text" name="email" id="email" />

      </p>

      <p>

        <label for="address_1">Address 1:</label>

        <input name="address_1" type="text" id="address_1" size="50" maxlength="70" />

        <br />

        <label for="address_2">Address 2:</label>

        <input name="address_2" type="text" id="address_2" size="50" maxlength="70" />

      </p>

      <p>

        <label for="city">City:</label>

        <input name="city" type="text" id="city" size="25" maxlength="40" />

        <label for="state">State</label>

        <input name="state" type="text" id="state" size="4" maxlength="2" />

        <label for="zip">Zip Code:</label>

        <input name="zip" type="text" id="zip" size="7" maxlength="5" />

      </p>

      <p>

        <label for="comment">Details Regarding Your Request:<br />

        </label>

        <textarea name="comment" cols="50" rows="7" id="comment"></textarea>

      </p>

      <p>

        <label for="submit"></label>

        <input type="submit" name="submit" id="submit" value="Submit" />

        <label for="reset"></label>

        <input type="reset" name="reset" id="reset" value="Reset" />

      </p>

    </form>';

    }

 

    ?>

 

Please help!

Link to comment
https://forums.phpfreaks.com/topic/205790-php-form-emailer-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.