note 50638 added to ref.mail
| From: | 3safiroo at osu1 dot php dot net | Date: | Sat, 05 Mar 2005 12:25:52 +0000 |
| Subject: | note 50638 added to ref.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85970@lists.php.net to get a copy of this message | ||
Can we send mail using localhost ?
I always get this error in the function mail($to, $subject, $message, $headers); .
This is the code:
<?
$contents=$HTTP_POST_VARS['text'];
$from = $_POST['from'];
$subject = $_POST['subject'];
$text=$HTTP_POST_VARS['text'];
$to = 'something@Example.com';
$subject = '$subject';
$message = '$text';
$headers = 'From: webmaster@' . $_SERVER['SERVER_NAME'] . "\r\n" .
'Reply-To: webmaster@' . $_SERVER['SERVER_NAME'] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if($from=="")
{
echo ("<script language='javascript'> alert(' Sorry, Type your E-mail
Address please')
window.location='contactus.htm'
</script>");
}
if($subject=="")
{
echo ("<script language='javascript'> alert(' Sorry, Type the E-mail
subject please')
window.location='contactus.htm'
</script>");
}
if($contents=="")
{
echo ("<script language='javascript'> alert(' Sorry, Type the comments
please')
window.location='contactus.htm'
</script>");
}
if($from!=""){
if($subject!=""){
if($message!=""){
mail($to, $subject, $message, $headers);
}
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/ref.mail.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50638
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50638&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50638&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50638&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50638&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50638&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50638&report=yes
Search -- http://master.php.net/manage/user-notes.php