我開發了一個CMS,當用戶忘記他/她的密碼時,系統會生成一個新的隨機密碼並通過電子郵件發送給用戶,但是當我打開電子郵件時,它會自動剝離一些字符從我的電子郵件正文替換(=)。Codeigniter去除HTML郵件中的字符
這是後電子郵件的發送,你可以看到搞砸了部分加粗
親愛努爾Shirzai這封電子郵件是本身爲了通知您,您的密碼已是= T你= N重置。 貝婁是您的新密碼: 您的用戶名是:mohib 你的PAS =字是:IOODiGhcYYrL 請以只要你登錄時更改您的< =阮富仲>新密碼系統=避免任何安全問題。
注意:當我發送此純PHP郵件功能它工作正常。
波紋管是我的電子郵件功能和電子郵件配置文件代碼:
我真的感謝所有幫助我得到。 感謝
我的功能發送郵件:
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 .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';
$message .= '<meta content="text/html; charset=utf-8" http-equiv="Content-type">';
$message .= '<head>';
$message .= '<title> Your New Password : Noor CMS | '.$CI->config->item('site_name').' </title>';
$message .= '</head>';
$message .= '<body>';
$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 .= '</body></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;
}
}
而且email.php配置文件如下:
$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;
如果鏈接不提供幫助,那麼它可能是行長的問題。 –