![]() |
invalid email From: header syntax per RFC 822 - 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: invalid email From: header syntax per RFC 822 (/showthread.php?tid=18574) |
invalid email From: header syntax per RFC 822 - El Forum - 05-11-2009 [eluser]Moobies[/eluser] Hey, I think I've stumbled upon a bug with the Email library of CI, latest version 1.7. I am using Mercury as a localhost SMTP server as part of XAMPP and it throws 501 Bad recipient address syntax errors at me. I have dug a little deeper and found that CI is sending what appears to be a bad From: header syntax. The correct syntax for From headers as far as I can make out from the RFC is From: [email protected] From: Code Igniter <[email protected]> From: [email protected], john@Smith.com If I use CI->email->send("[email protected]") then CI sends From: <[email protected]> And CI->email->send("[email protected]", "Code Igniter") sends From: "Code Igniter" <[email protected]> Both of which are syntactically wrong, or if not wrong they do not match the syntax I have found from the RFC and the mail server I am sending to does not like it either. If I modify the CI source for the from function to account for the syntax. Code: function from($from, $name = '') This produces [From] => [email protected] [Return-Path] => <[email protected]> Which works when not using a name in the from() call. The above function, when using a name to the from() function will produce as per the syntax [From] => Code Ingiter <[email protected]> [Return-Path] => <[email protected]> However, this still breaks the mail server and I get the 501 error again despite this matching the correct syntax. So not too sure about what is happening when using a from name. Any ideas/suggestions? Am I wrong about the syntax here or is there an issue going on? Cheers invalid email From: header syntax per RFC 822 - El Forum - 05-11-2009 [eluser]Michael Wales[/eluser] RFC 2822 made RFC 822 obsolete and introduced the patterns you are seeing in CodeIgniter's output (RFC 2822 is obsolete as well, RFC 5322 is the latest). The patterns <[email protected]> and "A User" <[email protected]> are both valid according to the addr-spec (Example A.1.2 features both of these formats in addition to others). I'm leaning to Mercury being misconfigured (or maybe an older version of Mercury, but I doubt that RFC 2822 was released in April 2001). |