CodeIgniter Forums
[Ok] Email / HTML - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: [Ok] Email / HTML (/thread-26011.html)



[Ok] Email / HTML - El Forum - 01-03-2010

[eluser]Unknown[/eluser]
Hi,

I use the email library in a script with smtp.
It's works well in "plain/text" but it doesn't works when i want to send an HTML one.

When i add $config['mailtype'] = 'html' in config/email.php i don't receive any mail.

config/email.php code:
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtpauth.online.net';
$config['smtp_port'] = 587;
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'mypasswd';
// when the following line is comment it's works well.
$config['mailtype'] = 'html';
$config['newline'] = "\r\n";
?>

part of controleur/home.php
Code:
$this->load->library('email');
            $this->email->set_newline("\r\n");
            $this->email->from('[email protected]', 'my-site');
            $this->email->to('[email protected]');
            $this->email->subject('Test');
            $this->email->message('<p>
test <a href="http://www.google.com">google.com</a></p>');

            if($this->email->send()){
                echo 'Your email was sent!';
            }

If you've got any idea Smile

Thank you and happy new year



EDIT :

in the config/email.php you have to create :
Code:
$config['charset']  = 'iso-8859-1';

Easy!