• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Simple PHP mailing script problem.

unholy414

Member
I am trying to set up a PHP-based contact form on my site. Everything sends just fine and reaches my e-mail box, except that the sender's e-mail doesn't appear in the "from" area of the e-mail. Instead my host fills in some random domain and that's it. Screen-shotted below...

Screenshot

I've have searched endlessly, sent numerous test e-mails, and a bunch of other BS I can't even think of because my brain is so fried out from this....but I think I'm close. I've attached my PHP code. I've taken out all of my changes to it (in efforts to get this to work) so as to not confuse everyone with junk code.

Someone, please, give me a hand here.

-thanks


<?php
if(isset($_POST['Submit'])) {

$to = "edited";
$name_field = $_POST['name1'];
$email_field = $_POST['email1'];
$subject_field = $_POST['subject1'];
$subject = $_POST['subject1'];
$message = $_POST['message1'];


$body = "Name: $name_field\n E-Mail: $email_field\n Subject: $subject_field\n Message: $message";

echo "Your E-mail has been submitted. We will get back to you when time permits.";
echo "You may now close this window.";
mail($to, $subject, $body);

} else {

echo "Delivery Failed!";

}
?>


 
The from and reply-to entries are pulled from the headers.

$headers = "From: " . $from."\n"."Return-Path: ".$from."\n"."Reply-To: ".$from."\n";
mail($to, $subject, $msg, $headers);
 
I can just fucking cry right now, it finally works. You guys solved it with blistering speed. Thank you guys so much!!

Too many times on my search that I find people say, "I solved it!!" and didn't post their code. Well I'm not going to do that either, I'm going to go one better.

Here's my HTML page, PHP code, and stuff in a .rar archive for anyone who wants a plug-and-play solution. I can vouch for its correctness because I must've sent 20 e-mails on it to put it through it's paces. I can reply effortlessly as if the e-mails were sent from a well-established e-mail client.

You just have to edit a line or two and you're off. ReadMe included. HTML file was created in Dreamweaver CS3.

http://files.filefront.com/mai...163664;;/fileinfo.html
 
Back
Top