not sending mail
Posted: Tue Dec 16, 2003 3:43 am
i am using the mail() function. the problem is that when I use the script on one server all goes well. when i use the script on an other server, the mail is only sent to people that have web email boxes like hotmail.com, but not received by people using for exampe outlook. Any idea why this might be?
this is the script i am using:
<?php
/* First display the code for the form */
if (!$email) {
if ($email="")echo "please fil in";
function emailcheck($intext) {
$theresults = ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $intext, $trashed);
if ($theresults) { $isamatch = "Yes"; } else { $isamatch = "Please check the format of your email address"; }
echo("$isamatch<br>\n");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pampers e-mail form</title>
</head>
<body>
<?php
emailcheck("$email");
/* This is de part where the HTML mail is sent to $email */
} else {
/* Email sender */
$from = "hansie";
/* subject */
$subject = "hansie_mail";
/* message */
$message = '
<html>
<head>
<title>Mail</title>
</head>
<body bgcolor="#CCFFCC" >
<form method="post" action="http://www.whatever.com" id=form1 name=form1>
Email Address: <input name="email" size="32"> <input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
';
/* headers */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$from."\r\n";
/* and now mail it */
mail($email, $subject, $message, $headers);
/* display text on screen */
echo 'E-mail succesfully sent to: '.$name.'.';
}
?>
<?php if (!$email) { ?>
Please ensure you have completed
</body>
</html>
<?php } ?>
this is the script i am using:
<?php
/* First display the code for the form */
if (!$email) {
if ($email="")echo "please fil in";
function emailcheck($intext) {
$theresults = ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $intext, $trashed);
if ($theresults) { $isamatch = "Yes"; } else { $isamatch = "Please check the format of your email address"; }
echo("$isamatch<br>\n");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pampers e-mail form</title>
</head>
<body>
<?php
emailcheck("$email");
/* This is de part where the HTML mail is sent to $email */
} else {
/* Email sender */
$from = "hansie";
/* subject */
$subject = "hansie_mail";
/* message */
$message = '
<html>
<head>
<title>Mail</title>
</head>
<body bgcolor="#CCFFCC" >
<form method="post" action="http://www.whatever.com" id=form1 name=form1>
Email Address: <input name="email" size="32"> <input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
';
/* headers */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$from."\r\n";
/* and now mail it */
mail($email, $subject, $message, $headers);
/* display text on screen */
echo 'E-mail succesfully sent to: '.$name.'.';
}
?>
<?php if (!$email) { ?>
Please ensure you have completed
</body>
</html>
<?php } ?>