Friday 15 August 2014

PHP Mail format and alternate

$to = "receiver@gmail.com";
   $subject = "'".$sendername."' Send a message to '".$receivername."'";

   $message = "
   <html>
   <head>
   <title>HTML email</title>
   </head>
   <body>
   <p>'".$sendername."' Send a message to '".$receivername."'</p>
   <table>
   <tr>
   <th>Message</th>
   </tr>
   <tr>
   <td>".$_POST['Message']."</td>
   </tr>
   </table>
   </body>
   </html>
   ";

   // Always set content-type when sending HTML email
   $headers = "MIME-Version: 1.0" . "\r\n";
   $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

   // More headers
   $headers .= 'From: <kumarappan@smaatapps.com>' . "\r\n";
   $headers .= 'Cc: myboss@example.com' . "\r\n";

   mail($to,$subject,$message,$headers);

No comments:

Post a Comment