Mail()?

I have a html page that ?Id like to email myself and was just going over how to do it.
Is this a good start?


 <? 
    //change this to your email. 
    $to = "m@maaking.com"; 
    $from = "m2@maaking.com"; 
    $subject = "Hello! This is HTML email"; 

    //begin of HTML message 
    $message = "<html> 
  <body bgcolor=\\"#DCEEFC\\"> 
    <center> 
        <b>Looool!!! I am reciving HTML email......</b> <br> 
        <font color=\\"red\\">Thanks Mohammed!</font> <br> 
        <a href=\\"http://www.maaking.com/\\">* maaking.com</a> 
    </center> 
      <br><br>*** Now you Can send HTML Email <br> Regards<br>MOhammed Ahmed - Palestine 
  </body> 
</html>"; 
   //end of message 

    // To send the HTML mail we need to set the Content-type header. 
    $headers = "MIME-Version: 1.0rn"; 
    $headers .= "Content-type: text/html; charset=iso-8859-1rn"; 
    $headers  .= "From: $from\\r\
"; 
    //options to send to cc+bcc 
    //$headers .= "Cc: [email]maa@p-i-s.cXom[/email]"; 
    //$headers .= "Bcc: [email]email@maaking.cXom[/email]"; 
     
    // now lets send the email. 
    mail($to, $subject, $message, $headers); 

    echo "Message has been sent....!"; 
?>  

Also, how do I add php variables inside $message (like before the <center>)

Thank you!!!

Looks like it. Note that you are missing a couple of backslashes in $headers, but it could just be the forums doing that.

Also, how do I add php variables inside $message (like before the <center>)

Just put them in. If they are plain text not HTML, escape them with htmlspecialchars:



  $notice = htmlspecialchars("Whatever notice you like");

 //begin of HTML message 
    $message = "<html> 
  <body bgcolor=\\"#DCEEFC\\"> 
    <p>$notice</p>
    <center> 
        <b>Looool!!! I am reciving HTML email......</b> <br> 
        <font color=\\"red\\">Thanks Mohammed!</font> <br> 
        <a href=\\"http://www.maaking.com/\\">* maaking.com</a> 
    </center> 
      <br><br>*** Now you Can send HTML Email <br> Regards<br>MOhammed Ahmed - Palestine 
  </body> 
</html>"; 
   //end of message 

For a general audience, you’re probably fine sending it as HTML without a text-only alternative in this day and age.