Welcome Guest, Not a member yet? Register   Sign In
Codeigniter strips characters from HTML Email
#1

[eluser]Unknown[/eluser]
0 down vote favorite


I have developed a CMS and when user forgets his/her password / the system will generate a new random password and send it to the user through email but when i open the email it automatically strip some character from my email body replacing them with (=).

This is the email after its sent you can see the messed up parts in bold

Dear Noor Shirzai This Email was se=t to you in order to inform you that your Password has be=n reset. Bellow is your New Password : Your Username is : mohib Your New Pas=word is : IOODiGhcYYrL Please change your <=trong> New Password </strong> as soon as you login to the system in order to=avoid any security issues.

Note : when i send this with Pure PHP mail function it works fine.

bellow is my email function and the email configuration file code:

I will really appreciate any help that i get. thanks

my function that send the mail:
Code:
if (! function_exists('send_password'))
{
    function send_password($user_info, $password)
    {
        $CI =& get_instance();

        $username           = $user_info['username'];
        $name               = $user_info['firstname'].' '.$user_info['lastname'];
        $email              = $user_info['email'];

        $subject            = 'Your New Password : Noor CMS |'.$CI->config->item('site_name');
        //email body
        $message            = '';

        $message            .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
        $message            .= '&lt;html xml:lang="en" lang="en"&gt;';
        $message            .= '&lt;meta content="text/html; charset=utf-8" http-equiv="Content-type"&gt;';
        $message            .= '&lt;head&gt;';
        $message            .= '&lt;title&gt; Your New Password : Noor CMS | '.$CI->config->item('site_name').' &lt;/title&gt;';
        $message            .= '&lt;/head&gt;';
        $message            .= '&lt;body&gt;';
        $message            .= 'Dear '.trim($name);
        $message            .= 'This Email was sent to you in order to inform you that your <strong>Password</strong> has been reset.<br/>';
        $message            .= 'Bellow is your <strong> New Password :</strong><br/>';
        $message            .= 'Your <strong>Username </strong>is : <strong> '.trim($username).'</strong><br/>';
        $message            .= 'Your <strong>New Password </strong>is : <strong> '.trim($password).'</strong><br/>';
        $message            .= 'Please change your <strong>New Password</strong> as soon as you login to the system in order to avoid any security issues.<br/>';
        $message            .= '&lt;/body&gt;&lt;/html>';

        //prepare email and send
        $CI->email->from($CI->config->item('admin_email'), $CI->config->item('admin_name'));
        $CI->email->to($email);
        $CI->email->subject($subject);
        $CI->email->message($message);

        if ($CI->email->send())
        {
            return TRUE;
        }

        return FALSE;
    }
}

And the email.php config file is as follows:

Code:
$config['useragent']            = 'NoorCMS';
$config['protocol']         = 'mail';
$config['mailpath']         = '/usr/sbin/sendmail';
$config['smtp_host']            = '';
$config['smtp_user']            = '';
$config['smtp_pass']            = '';
$config['smtp_port']            = 25;
$config['smtp_timeout']         = 10;
$config['wordwrap']         = FALSE;
$config['wrapchars']            = 100;
$config['mailtype']         = 'html';
$config['send_multipart']       = FALSE;
$config['charset']          = 'utf-8';
$config['validate']         = FALSE;
$config['priority']         = 1;
$config['crlf']             = '\n';
$config['newline']          = '\n';
$config['bcc_batch_mode']   = FALSE;
$config['bcc_batch_size']       = 200;
#2

[eluser]CroNiX[/eluser]
try changing your newline and crlf parameters to
"\r\n", in double quotes.
#3

[eluser]Unknown[/eluser]
thanks CroNiX you saved my life i was stuck with this for last four days, but can you tell me the details on this particular problem that would really be helpful in the future.
Thanks Agian




Theme © iAndrew 2016 - Forum software by © MyBB