Web Hosting Talk







View Full Version : PHP Sendmail problem


HostFX-UK
02-19-2009, 11:20 PM
The code is sending the email but when I receive it, the Sender says:
Can you tell me how to prevent this?
Here is the code:
<?php
$sql4 = "SELECT * FROM settings";
$query4 = mysql_query($sql4) or die("Cannot query
the database.<br>" . mysql_error());
while($result = mysql_fetch_array($query4)) {
$my_email = $result['adminemail'];
}
$Emaila = $_POST['Emaila'];
if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}
while(list($key,$value) =
each($_POST)){if(!(empty($value))){$set=1;}$message
= $message . "$key: $value\n\n";}
if($set!==1){header("location:
$_SERVER[HTTP_REFERER]");exit;}
$message = stripslashes($message);
$subject = "WHMaster - User '" .
$_SESSION['username'] . "' submitted a ticket!";
$headers = "From:WHMaster" . $Emaila . "\n" .
"Return-Path: " . $Emaila . "\n" . "Reply-To: " .
$Emaila . "\n";
$message = "The user '" . $_SESSION['username'] . "'
submitted a support ticket.\r\n
Please login to WHMaster Admin to view and
respond\r\nThank You";
mail($my_email,$subject,$message,$headers);
echo "<center><strong>Support Ticket
Submitted!<br>Please allow 24-48 hours for a
reply!</strong></center>";
?>

glintz
02-20-2009, 12:16 AM
Is your post missing something?
You've got 'the Sender says:' and then nothing...What does the Sender say?
Regardless of what the Sender says, you're missing a few paramters from your headers.
Cheers
Brad

HostFX-UK
02-20-2009, 12:19 AM
When I receive the email the sender says:
WHMaster@server1.hostfx.co.uk

glintz
02-20-2009, 12:48 AM
The sender address is probably being modified by the server becuase the sender address isn't from an account on the server.
Why would you want to insert your clients email address as the sender anyway? Looking at the message your sending it doesn't look like it needs to be.
Cheers
Brad