PHP Mailer From 'Nobody' ?
Posted: Mon Feb 22, 2010 2:40 pm
Hello, I have attached my PHP code. The script works fine and sends the e-mail, but in my Gmail inbox, the e-mail shows it is from 'Nobody' (attached img). Is there a way I can change this? Would I use a $header variable? Thanks in advance.
Code: Select all
<?php
if(isset($_POST['submit'])) {
$to = "ryanbuening@gmail.com";
$subject = "Contact Form";
$firstname_field = $_POST['first'];
$lastname_field = $_POST['last'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
$order_field = $_POST['ordernum'];
$topic_field = $_POST['topic'];
$comments = $_POST['comments'];
$body = " From: $firstname_field $lastname_field\n\n E-Mail: $email_field\n\n Phone #: $phone_field\n\n Order #: $order_field\n\n Topic: $topic_field\n\n Comments: $comments";
header ("Location: http://www.ryanbuening.com/thankyou.html");
mail($to, $subject, $body);
}
else {
echo "Error!";
}
?>