Issue
I need to send html email. So I am using PEAR library with Mail extension
So I have written this code:
include('Mail.php');
include('Mail/mime.php');
$email = "xxx@gmail.com";
$from_addr = "example <yyy@gmail.com>";
$message_subject ="Test";
$text = "
Hello.
This is a link:
http//:www.hardevent.net/index.php
byebye
";
$html = "<html>
<body>
<p>
Hellooooo, this is a link:
</p>
<a href=\"http://www.google.com\"/>Gooooo</a>
</body>
</html>";
$headers = array ("From" => $from_addr,
"To" => $email,
"Subject" => $message_subject);
$crlf = "\n";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$body = $mime->get();
$hdrs = $mime->headers($headers);
$smtp = Mail::factory("smtp", array ('host' => "smtp.xxx.com",
'auth' => true,
'username' => "xxx",
'password' => "xxx"));
$mail = $smtp->send($email, $hdrs, $body);
But this is the email that I see ( only text without link ):
Object: Test
Hellooooo, this is a link:
Gooooo
why ?
Solution
Typo?
<a href=\"http://www.google.com\">Gooooo</a>
Answered By - Tommy Answer Checked By - Katrina (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.