Jump to content

HTML mail issue


Deoctor

Recommended Posts

Hai

i have made one email program with the html content but still i get the html code in my mail

can any one help me out..

<!-- send mail using  an smtp-->

<?php
require_once "Mail.php";

$from = "";
$to = "";
$subject = "Hi!";
$body = "<h1>Hi</h1>,\n\nHow are you?";
$body .= '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</body>
</html>
';
$host = "";
$username = "";
$password = "";
/*$host = "mail.example.com";
$username = "smtp_username";
$password = "smtp_password";*/
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
  echo("<p>" . $mail->getMessage() . "</p>");
} else {
  echo("<p>Message successfully sent!</p>");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/193755-html-mail-issue/
Share on other sites

  Quote

You can try using ob_start()

and in some mail boxes html is disabled by default.

So in some thing like SquirrelMail html might be disabled when in hotmail it will be enabled.

 

i am sending the mail to my gmail id using my smtp server..

when i send it using the localhost it does not sent in the html format

where as if i send using my server it sends..

but i want the mail to be sent using my local host

so hw do i do it..??

 

Link to comment
https://forums.phpfreaks.com/topic/193755-html-mail-issue/#findComment-1019812
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.