CodeIgniter Forums
Dreamhost + Gmail SMTP + CI - 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: Dreamhost + Gmail SMTP + CI (/showthread.php?tid=18935)



Dreamhost + Gmail SMTP + CI - El Forum - 05-22-2009

[eluser]Vicente Russo[/eluser]
Helloo fellows, I need a little push here.

I`m trying to send and email with smtp, hosted on dreamhost. The thing is, I dont know where is the problem. I got an 404 error when I execute $this->email->send();

Code:
$this->load->library('email');
            
            
            $config = Array(
              'protocol' => 'smtp',
              'smtp_host' => 'ssl://smtp.gmail.com',
              'smtp_port' => 587,
              'smtp_user' => 'myuser@mydomain',
              'smtp_pass' => 'mypass'
            );

            $this->email->initialize($config);
            

            $this->email->from('myuser@mydomain', 'Vicente');
            $this->email->to('[email protected]');

            $this->email->subject('Email Test');
            $this->email->message('Testing the email class.');

            $this->email->send();

            echo $this->email->print_debugger();

Checking the apache logs, I got "Premature end of script headers: index.php" error.

So what can it be? :S

Thx!


Dreamhost + Gmail SMTP + CI - El Forum - 05-22-2009

[eluser]Dam1an[/eluser]
When you say you get a 404 error, is this the CI 404 or the real 404?


Dreamhost + Gmail SMTP + CI - El Forum - 05-22-2009

[eluser]Vicente Russo[/eluser]
CI 404 !


Dreamhost + Gmail SMTP + CI - El Forum - 05-22-2009

[eluser]Dam1an[/eluser]
Any redirects later on in the function?


Dreamhost + Gmail SMTP + CI - El Forum - 05-22-2009

[eluser]Vicente Russo[/eluser]
No redirects. The script ends echoing the print_debugger function.

But I added the following line, and it worked:

Code:
$this->email->set_newline("\r\n");

But I don`t know why the CI 404 error showed up. Misteries....


Dreamhost + Gmail SMTP + CI - El Forum - 05-22-2009

[eluser]Dam1an[/eluser]
I came accross a thread earlier where chanign the newline character to \r\n fixed something as well (can't remember what though)