1

I'm sending out an email using CodeIgniter's built in library. All I'm trying to do is send a bolded string, but instead of rendering the tags, it is printing them. What I have:

<html>
 <head>
 </head>
 <body>
 <b>Donkey</b>
 </body>
 </html>

That is, character for character, the email I'm getting. Why aren't the tags rendering?

2
  • Does this only cause problems with Gmail? If you read the email in Outlook, or Yahoo! Mail, does it render correctly? May 17, 2010 at 18:16
  • 1
    Probably has to do with the sending mime type... check the codeigniter library's api for a way to toggle sending an html version.
    – Kzqai
    May 17, 2010 at 18:17

2 Answers 2

5

From the documentation:

$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';

$this->email->initialize($config);

The CodeIgniter Email class defaults to sending text emails. Unless you specify that the mailtype is HTML ($config['mailtype'] = 'html';) your html will be sent out as text.

0

Have you tried

<span style='font-weight: bold'>My bold text</span>

OR

<strong>another bold tag</strong>

?

We use these and they both work for Gmail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.