Jump to content


Sending email message...


  • Please log in to reply
3 replies to this topic

#1 Guest_askjames01_*

Guest_askjames01_*
  • Guests

Posted 13 March 2006 - 07:51 AM

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:
<?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");

    }
        }
?>

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

-/james


#2 Guest_askjames01_*

Guest_askjames01_*
  • Guests

Posted 13 March 2006 - 09:47 AM

Ok, just change the I.P. address with your address so it works with you....


#3 fusionpixel

fusionpixel
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 13 March 2006 - 09:52 AM

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.

Did you know there is a manual for PHP? [a href="http://" target="_blank"]http://www.php.net[/a]
Did you know there is a manual for mySQL? [a href="http://" target="_blank"]http://www.mysql.org[/a]

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 13 March 2006 - 02:38 PM

You have:
<?php
                $headers = "Reply-to: webmaster@domain_name.com\n";
                mail($recepient, $subject, $contents, "From: webmaster@domain_name.com");
?>
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.

<?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);
?>

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

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users