Forum Moderators: coopster
can any tell me how to send mails from site using mail() in php
do we need to change in the php.ini
these are in php.ini
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
sendmail_from = me@example.com
and i tried with this example it is giving me the message saying "message successfully sent" but there is no mail in my inbox
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head><body>
<?php
$to = "email@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (!is_null($to))
{
mail($to, $subject, $body);
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
</body>
</html>
[edited by: eelixduppy at 6:41 am (utc) on Dec. 24, 2008]
[edit reason] removed specifics [/edit]