Jump to content

Archived

This topic is now archived and is closed to further replies.

Guest askjames01

Sending email message...

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

Share this post


Link to post
Share on other sites
Guest askjames01
Ok, just change the I.P. address with your address so it works with you....

Share this post


Link to post
Share on other sites
If I understand what you are saying you comment that you cant send emails through your browser?

Some hosting companies block the ability to send emails through your browser.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.