Hi all, i am new in php, I looked lots of example from Forum and tried online server but its nt work at all, i know i may be doing great mistake to sending HTML mail. last time i tried this code beloo, pls give me idea what is the erroe and its say "Mail Failed'
<?php
$to = 'example@test.c om';
$subject = 'Test HTML email';
$random_hash = md5(date('r', time()));
$headers = "From: webmaster@examp le.com\r\nReply-To: webmaster@examp le.com";
$headers .= "\r\nConten t-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash. "\"";
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello World!!!
This is simple text email message.
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<h2>Hello World!</h2>
<p>This is something with <b>HTML</b> formatting.</p>
--PHP-alt-<?php echo $random_hash; ?>--
<?
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
what i need to do clearly if i want to send HTML email?
&
what need to do for testing on my PC in xp OS
&
what i need to do on real server when i will keep it?
Thx a lot