Jump to content

PHP Mail Form Help


TheSaint97

Recommended Posts

Ok for the most part this script gets the job done. However, for some strange reason when I receive the email from them, instead of having their email address in the "From:" it has some weird address like: [email protected]

 

Now in the body of the email it will list their correct address. Here is part of the script I'm using...

 

<?php

 

/* Subject and Email Variables */

 

$to = '[email protected]';

$subject = 'Form Submission';

 

/* Data Variables */

 

$name = $_POST['name'];

$phone = $_POST['phone'];

$address = $_POST['address'];

$name = $_POST['name'];

$phone = $_POST['phone'];

$address = $_POST['address'];

$city = $_POST['city'];

$state = $_POST['state'];

$email = $_POST['email'];

$type = $_POST['type'];

$reason = $_POST['reason'];

$value = $_POST['value'];

$owed = $_POST['owed'];

$repairs = $_POST['repairs'];

$agent = $_POST['agent'];

$offer = $_POST['offer'];

 

/* What Will Appear in Body of Email */

 

$body = <<<EOD

<br><hr><br>

Name = $name <br>

Phone = $phone <br>

Address = $address <br>

City = $city <br>

State = $state <br>

Email = $email <br>

Type = $type <br>

Reason = $reason <br>

Value = $value <br>

Owed = $owed <br>

Repairs = $repairs <br>

Agent = $agent <br>

Offer = $offer <br>

EOD;

 

/* To send HTML mail, the Content-type header must be set */

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

 

/* Additional headers */

$headers .= 'From: $email' . "\r\n";

$headers .= 'Cc: [email protected]' . "\r\n";

$headers .= 'Bcc: [email protected]' . "\r\n";

 

/* Mail it */

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

 

Also, once in awhile I will get an email where the body is completely empty. It will still list

 

Name =

Phone =

Address =

City =

State =

Email =

Type =

Reason =

Value =

Owed =

Repairs =

Agent =

Offer =

 

It just doesn't show the answer they gave. I'm a beginner so any help would be greatly appreciated. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/135216-php-mail-form-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.