![]() |
Bug in Email class caused issue when used with qmail due to crlf - [SOLVED] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Bug in Email class caused issue when used with qmail due to crlf - [SOLVED] (/showthread.php?tid=1758) |
Bug in Email class caused issue when used with qmail due to crlf - [SOLVED] - El Forum - 06-25-2007 [eluser]yongkhun[/eluser] I have faced lots of issues with the email class in CodeIgniter. When I tried to send email using SMTP, it gives me error as follow: Code: ----------------------------------------- Bug in Email class caused issue when used with qmail due to crlf - [SOLVED] - El Forum - 06-25-2007 [eluser]yongkhun[/eluser] I found that the member function set_newline() in Email class has a bug (Email.php). It will never set "\r\n" due to the if checking in the beginning of the function because it will always set to "\n" no matter what other escape characters you are trying to set it with. So, to correct the bug, just replace the OR with XOR instead as follow: Code: function set_newline($newline = "\n") Also, when you initialize the email config, be careful not to use single-quote for the newline value. Otherwise, the escape characters of \r or \n will not be taken properly. Although this is PHP fundamental, but it might be easily overlooked especially when misled by the example in codeigniter manual when setting other email config. Code: $mailconfig['protocol'] = 'smtp'; // no issue with single-quote here as in the example of codeigniter manual Hope this saves the time for others when encountered with the same issue. Bug in Email class caused issue when used with qmail due to crlf - [SOLVED] - El Forum - 08-07-2011 [eluser]Dennis Geus[/eluser] Yes, that was the solution, thank you Don't use single quotes. Bug in Email class caused issue when used with qmail due to crlf - [SOLVED] - El Forum - 01-20-2012 [eluser]hyperfire[/eluser] I'm having this same error. Tryied the sugested "fix" with no luck so far. Still have the same error msg: 451 See http://pobox.com/~djb/docs/smtplf.html. The following SMTP error was encountered: 451 See http://pobox.com/~djb/docs/smtplf.html. Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. What should I do? Using qmail on a default MT DV with CI 2.1 with this code Code: $mail_msg = $this->mBody($tpl, $data, $subject); |