Email from form shows from web user

Apologies if this isnt a php issue im not 100% sure but i noticed that when i send an email from a form on my site it shows up that its from “web user” and a question mark

is there anyway to change this?

/* Set e-mail recipient */
$myemail = ",";//"YOUR EMAIL ADDRESS";
/* Check all form inputs using check_input function */
$name = check_input($_POST['name'], "Enter your name");
$email = check_input($_POST['email']);
$message = check_input($_POST['message'], "Write your message");
/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
show_error("E-mail address not valid");
/* Let's prepare the message for the e-mail */
$message = "
Name: $name
E-mail: $email
/* Send the message using mail() function */
mail($myemail, "AllenTrey Prod.", $message);
/* Redirect visitor to the thank you page */
header('Location: contact.html');
/* Functions we used */
function check_input($data, $problem='')
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
return $data;
function show_error($myError)
<p>Please correct the following error:</p>
<strong><?php echo $myError; ?></strong>
<p>Hit the back button and try again</p>

This should be an easy fix but could you provide some code so that people can assist you properly!?

i added the code ; any advice at all would be greatly appreciated :slight_smile:

What actually shows in the email header, rather than what your email client shows? You don’t actually set the “from” address anywhere in that code, so it must be getting a default from somewhere.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.