|
-
May 1st, 2007, 08:43 AM
#1
Thread Starter
Frenzied Member
Preserve special html char?
I am setting up a phpbb board and may need to email people things from time to time, well just tested out the mail() function to my yahoo beta account and if i try and send a link such as,
PHP Code:
<?php
$content ="<a href ='http://www.mylink.com'>Click me</a>";
mail($to,$subject,$content);
//etc..
?>
Then it not rendered right in yahoo the <'s become < etc, i have tried using,
PHP Code:
$content = htmlspecialchars("<a href ='http://www.mylink'>click me</a>", ENT_QUOTES);
but no difference...
any ideas?
-
May 1st, 2007, 08:48 AM
#2
Re: Preserve special html char?
I don't recommend sending HTML emails, but to do so, you need to set the content type to text/html; otherwise, the receiving client will treat them as plain text, which is what's happening here.
PHP Code:
mail($to, $subject, $content, "Content-type: text/html; charset=utf-8\r\n");
Some examples.
-
May 1st, 2007, 09:00 AM
#3
Thread Starter
Frenzied Member
Re: Preserve special html char?
excellent as always, why against html email's?
-
May 1st, 2007, 09:07 AM
#4
Re: Preserve special html char?
Here's a list of reasons: Why HTML in E-Mail is a Bad Idea.
The author may have largely changed his opinion since, but I agree with most, although not all, of the points on that page.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|