Jump to content

Sending email message...


Guest askjames01

Recommended Posts

Guest askjames01
I tried sending email messages without using the form...
fortunately there was no error but the problem was i can't see the message in my inbox..

these are the codes:
[code]
<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo 'your I.P. address is: ';
echo $ip;

if($ip != '203.76.211.121')
       echo "ip not equal!\n";
else {
                $recepient = "webmaster@domain_name.com";
                $subject = "You have Guest!";

    $contents = "Your ip is:" . $ip;
                
                $headers = "Reply-to: webmaster@domain_name.com\n";
                mail($recepient, $subject, $contents, "From: webmaster@domain_name.com");

    }
        }
?>
[/code]

I wonder what was the problem with my codes or what do you think is lacking?

-/james
Link to comment
Share on other sites

You have:
[code]<?php
                $headers = "Reply-to: webmaster@domain_name.com\n";
                mail($recepient, $subject, $contents, "From: webmaster@domain_name.com");
?>[/code]
You create the $headers variable, but you don't use it. The "From:" header should be terminated with a new line character. You might have to include the fifth parameter on the mail() line.

[code]<?php
               $headers = "From: webmaster@domain_name.com\n";
               $headers .= "Reply-to: webmaster@domain_name.com\n";
               $p5 = '-f webmaster@domain_name.com';
                mail($recepient, $subject, $contents, $headers,$p5);
?>[/code]

The fifth parameter is almost always needed when sending to a Hotmail, Yahoo, Gmail, or AOL address.

Ken
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.