![]() |
php mail() works, CI email library doesn't: how to configure correctly? - 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: php mail() works, CI email library doesn't: how to configure correctly? (/showthread.php?tid=32797) |
php mail() works, CI email library doesn't: how to configure correctly? - El Forum - 08-05-2010 [eluser]w1ntermut3[/eluser] Hi, I should prefix this with: the mail/dns setup on the server is not ideal. It's a dedicated Windows box at a well-known - and godawful - uk hosting company. It's got one SMTP server installed by the control panel software on port 25, which is locked down for relaying and about as documented as an undocumented thing, and IIS's default SMTP server on port 26, which by rights is open to anything at all, although I'm b*ggered if I can get a peep out of it. Tech support at said hosting company seems to be staffed by surly teenagers who can just about read the "we don't support that" script in front of them. In addition, I'm hosting just the client site on the server: their MX records are still pointing at... wherever they were. We've not touched them: we're not allowed to touch them. Given our mail setup, you can probably appreciate why. So. I want to send an email from [email protected] This works: Code: ini_set('smtp_port', '25'); This doesn't: Code: $mail_config['protocol'] = 'smtp'; My question is: what's different between the two, and how do I make the second one match the first? Obviously the smtp host stands out - I've tried everything I can think of in there: full root domain, IP address, runic incantations. I keep returning this debug error: Quote:220 ****** SMTP Mail Server v(1.4) on Simple Mail Transfer Service Ready Anyone have a better idea than me what's going on here? I mean, obviously there ARE; there are probably small fish with a better understanding of mail in PHP than me, but any and all advice would be appreciated. Thanks. php mail() works, CI email library doesn't: how to configure correctly? - El Forum - 08-23-2010 [eluser]RiggsFolly[/eluser] I am having my own problems in this area but i did notice that you missed the Code: $this->email->initialize($config); after setting your $config variables and before doing all the to and from stuff. I think the order should be Code: $this->load->library( 'email' ); php mail() works, CI email library doesn't: how to configure correctly? - El Forum - 08-23-2010 [eluser]RiggsFolly[/eluser] Hi, I managed to solve my problems. I have successfully sent email via SMTP and CI_Mail. CI Version 1.7.2 OS Windows XP SP3 WAMP Server 2.0i - Apache 2.2.11 - PHP 5.3.1 - MySQL 5.1.36 hMailServer 5.3.2-B1769 running on separate PC on internal network. I am using a mailserver on my internal network called hMailServer. Its very good as a local testing mailserver. However my CI application would hang after receiving the first 220 <server name> message from the mail server and then eventually timing out after max php execution time and giving me NO IDEA what was wrong. I eventually found that it would only work with a "\r\n" for the newline and crlf parameters. If your problem is a "fast idle" in other words your page hangs as if downloading a HUGE page, this could be what your problem is. The class defines Code: var $newline = "\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822) So i used these parameters coded in my controller and all seemed to start working as if by magic. Code: $mail_config['protocol'] = 'smtp'; I hope some of this will point you to your problem. But suffice to say, it does work when you get all the environment/parameters correct. php mail() works, CI email library doesn't: how to configure correctly? - El Forum - 10-27-2010 [eluser]DanSearle[/eluser] thanks for that, the \r\n trick worked for me, I just added this to my email.php config file and it works great. Code: $config['crlf'] = "\r\n"; // CHANGED FROM DEFAULTS |