CodeIgniter的PHP梅勒问题
问题描述:
$MSG = "Dear " . $student['firstname'] . " " . $student['lastname'] . ", " . $student['class'] . " " . $student['section'] . " your userid & pass for school SIS is " . $student['username'] . " & " . $student['password'] . " Login at: " . $stu_setting['short_url'] . ", Welcome to " . $stu_setting['name'] . ".";
$skool = "Welcome to " . $stu_setting['name'] . " SIS";
$to_email = '[email protected]';
$this->CI->email->from('[email protected]');
$this->CI->email->to($to_email);
$this->CI->email->subject($skool);
$this->CI->email->message($MSG);
$this->CI->email->send();
使用https://github.com/ivantcholakov/codeigniter-phpmailer在CI发送电子邮件,但每当我试图把它改变了随机混合字符变量的值的电子邮件。但它会正确加载$ MSG。CodeIgniter的PHP梅勒问题
答
更改CRLF到\ r \ n和设置字符集UTF-8解决了这个问题。
$ to_email不工作时,我使用$ to_email = $学生[“电子邮件”] –
改变CRLF值用\ r \ n它解决了我的问题的一半,但仍受到等于迹象出现 –
笨有一个内置的电子邮件库https://www.codeigniter.com/user_guide/libraries/email.html – user4419336