View Full Version : SendMail defaulting to "anonymous"

07-04-2006, 03:38 PM
Emails are being sent alright except the From address is replaced with: anonymous@cgi1.cgi1
This is the code I am using. Do I need to instruct the script as to the location of sendmail? Sendmail on the Linux server at my Netfirm.com hosting service is: /usr/lib/sendmail. I have not seen in any other poster's codes where they had to use it. If you can, please show me what I need to do differently.

$From = "NevadaSam@gmail.com";
$To = "NevadaSam@gmail.com";
$Subject = "Test email";
$Message = "My first email test with php.";
$Headers = "$From: $From";
$MessageSent = mail($To, $Subject, $Message, $Headers);
if ($MessageSent) {
echo "<p>The following message was sent
successfully:</p><hr />";
echo "<p><strong>From</strong>: $From</p>";
echo "<p><strong>To</strong>: $To</p>";
echo "<p><strong>Subject</strong>: $Subject</p>";
echo "<p><strong>Message</strong>: $Message</p>";
echo "<p>The message was not sent successfully!</p>";

07-04-2006, 04:02 PM
$Headers = "$From: $From";

should be

$Headers = "From: $From";

and depending on your mailserver should have a trailing "\n" or "\r\n"

07-04-2006, 04:44 PM
Well, that was embarassing:o The person whom coined the phrase "There are no stupid question.", never meet me. I will try to proofread my scripts better.

Problem Solved!