Jump to content

Coolidge

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Coolidge

  1. OK, thanks. Again, brand new to PHP dev and this forum. I'm using code from a PHP reference, so not entirely sure what the From line is doing. I know that the value does not impact how the form behaves - it consistently comes from the gmail address. All I need is for the email to come from the address that's filled in on the form. Thanks again.
  2. Hello - I am very new to PHP. I have a simple form that uses gmail SMTP. The form works, but the sender always comes across as the email address from the gmail SMTP account. We need the sender to be the email address filled in on the form. Here is the form: <table width="50%" border="0"> <tr> <td>Name:</td> <td><INPUT maxLength="60" size="60" name="Applicant" required="yes" message="Please fill in your Name."></td> </tr> <tr> <td>Email Address:</td> <td><INPUT maxLength="60" size="60" name="EmailAddress" required="yes" message="Please fill in your Email Address."></td> </tr> </table> </p> <p><input type="submit" value="Submit" name="B1"></p> </form> Here is the PHP to send the form: <?php require_once "Mail.php"; $from = '<Form Submitter>'; $to = "me@webmaster.com"; $subject = "Application Access Request"; $body = "The following person has requested access to the Foundation:\r\n" . $_POST['Applicant'] . "\r\n" . $_POST['EmailAddress']; $headers = array( 'From' => $from, 'To' => $to, 'Subject' => $subject ); $smtp = Mail::factory('smtp', array( 'host' => 'ssl://smtp.gmail.com', 'port' => '465', 'auth' => true, 'username' => 'me@gmail.com', 'password' => 'xxxxx' )); $mail = $smtp->send($to, $headers, $body, $Applicant, $EmailAddress); if (PEAR::isError($mail)) { echo('<p>' . $mail->getMessage() . '</p>'); } else { echo('<p>Thank you. Your information has been successfully submitted.</p>'); } ?> How can I get the email to come from the address that's filled in on the form? I would be very grateful for any help...thank you so much!!
×
×
  • 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.