All pastes #18638 Raw Edit

Something

public text v1 · immutable
#18638 ·published 2005-07-27 16:33 UTC
rendered paste body
<?php
// specify your email below and that's all ;)
$to="enter valid email address here";

$number=1;
$message="Test Message";
if (mail("$to", "Test Subject $number", "${message} ${number}") == true) {
        print "Mail Test $number: Good :o)<br \>\n";
}
else {
        print "Mail Test $number: Bad :o(<br \>\n";
}
++$number;
if ( mail("$to", "Test Subject $number", "${message} ${number}", "From: webmaster@{$_SERVER['SERVER_NAME']}\r\n" . "Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n" . "X-Mailer: PHP/" . phpversion()) == true) {
        print "Mail Test $number: Good :o)<br \>\n";
}
else {
        print "Mail Test $number: Bad :o(<br \>\n";
}
++$number;
if (mail("$to", "Test Subject $number", "${message} ${number}", "From: webmaster@{$_SERVER['SERVER_NAME']}", "-fwebmaster@{$_SERVER['SERVER_NAME']}") == true) {
        print "Mail Test $number: Good :o)<br \>\n";
}
else {
        print "Mail Test $number: Bad :o(<br \>\n";
}
++$number;

/* subject */
$subject = "Test Subject $number";

/* message */
$message = "
<html>
<head>
 <title>Test Message $number</title>
</head>
<body>
<p><b>This is the test message $number!</b></p>
</body>
</html>
";

/* To send HTML mail, you can set the Content-type header. */
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

/* additional headers */
$headers .= "To: TEST <$to>\r\n";

/* and now mail it */
if (mail($to, $subject, $message, $headers) == true) {
        print "Mail Test $number: Good :o)<br \>\n";
}
else {
        print "Mail Test $number: Bad :o(<br \>\n";
}

exit;
?>