Jump to content

"From field" in PHP email form


sammymaudlin

Recommended Posts

I used a wizard to create a PHP email form.  I was able to customize it with the exception of the From field.  I need the email that is sent to be "From" the email that the sender input.  Instead it comes "From" a nonexistent email address with "server" in the domain.  Here is the processor code I'm using

 

<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));


mail("braintrack@yahoo.com", $_POST['field_3'], "

First Name: " . $_POST['field_1'] . "
Last Name: " . $_POST['field_5'] . "
Email Address: " . $_POST['field_2'] . "
Situation: " . $_POST['field_3'] . "
Message: " . $_POST['field_4'] . "




");

include("confirm.html");

?>

 

Any help would be greatly apprciated.

Link to comment
Share on other sites

$to = "braintrack@yahoo.com";
$subject = $_POST['field_3'];
$message = "First Name: " . $_POST['field_1'] . "
Last Name: " . $_POST['field_5'] . "
Email Address: " . $_POST['field_2'] . "
Situation: " . $_POST['field_3'] . "
Message: " . $_POST['field_4'];
$headers = "From: " . $_POST['field_2'] . "\r\n";

mail($to, $subject, $message, $headers);

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.