Question : Pear Mime email - HTML problem.

I am trying to send an email with the Pear Mime package. In the received email I do not get the HTML format. Even if I send HTML, I receive only text format. For example, in the foll. code, I send a link which does not appear in the email.
Please help me debug.
Thanks
ilakshmir
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
";
$to = "efg ";
$subject = "Hi";
 
$html = ' efg\'s gift is waiting at e-gifts . Sign in and claim it. ';
 
$hdrs = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject,
  );
 
$mime = new Mail_mime();  
$mime->setTXTBody(strip_tags($html));
$mime->setHTMLBody($html);
 
$body = $mime->get();
$hdrs = $mime->headers($hdrs);  
 
$smtp = Mail::factory('smtp',
  array ('host' => $host,
  	'port' => $port,
    'auth' => true,
    'username' => $username,
    'password' => $password));
 
$mail = $smtp->send($to, $hdrs, $body);
 
if (PEAR::isError($mail)) {
  echo("

" . $mail->getMessage() . "

"); } else { echo("

Message successfully sent!

"); } ?>
Open in New Window Select All

Answer : Pear Mime email - HTML problem.

Test with this and it work.
Please check your code.
Bonmat86.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
";
// Your message
$message="Hello \r\n";
$message.="This is test\r\n";
$message.="Test again";
 
// send email
$sentmail = mail($to,$subject,$message,$headers);
 
// if your email succesfully sent
if($sentmail){
echo "Email Has Been Sent .";
}
else {
echo "Cannot Send Email ";
}
 
?>
Open in New Window Select All
Random Solutions  
 
programming4us programming4us