CodeIgniter Forums

Full Version: Help with email class
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]ChaosKnight[/eluser]
Hi, I have struggled with the email class for quite a while now, and I just can't figure it out... I am upgrading an existing website to CodeIgniter, the old site used PHPMailer, and the host only supports SMTP with authentication.

With PHPMailer it was quite easy: set the protocol to smtp, activate smtp auth, pass host, username and password details, give the from, to, subject and message fields, send... I tried the same with the CodeIgniter email class and when I try to send it, it just loads extremely long, and after that it returns a completely blank page...

I use the method where you have a email.php config file in application/config/ I don't know if you have to tell CodeIgniter where you stored it...

Here is the config file (details left out):
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    $config['useragent'] = "CodeIgniter";
    $config['protocol'] = "smtp";
    $config['_smtp_auth'] = TRUE;
    $config['smtp_host'] = "******";
    $config['smtp_user'] = "******";
    $config['smtp_pass'] = "******";
/* End of Email.php config file */

And here is the controller bit that is supposed to send the email (details left out):
Code:
$this->load->library('email');
    $this->email->from('******','website');
    $this->email->to('******');
    $this->email->subject('Email Test');
    $this->email->message('Test email');
    if ( ! $this->email->send())
    {
        $data['page_title'] = 'Form';
        $this->load->view('header',$data);
        $this->load->view('nav');
        $this->load->view('sidebar');
        $this->load->view('form');
        $this->load->view('footer');
    }
    else
    {
        $data['page_title'] = 'Message sent';
        $this->load->view('header',$data);
        $this->load->view('nav');
        $this->load->view('sidebar');
        $this->load->view('sent');
        $this->load->view('footer');
    }

If someone can tell me what I did wrong I'll really appreciate your help!

Thanks!

El Forum

[eluser]ChaosKnight[/eluser]
I tried echo $this->email->print_debugger(); but it doesn't even return anything... Sad...

El Forum

[eluser]InsiteFX[/eluser]
email class

Code:
$config['smtp_port'] = "?";
$config['smtp_timeout'] = "?";

InsiteFX

El Forum

[eluser]ChaosKnight[/eluser]
My host uses the default port, and I saw that timeout is set to 5 by default also...

El Forum

[eluser]ChaosKnight[/eluser]
I tried InsiteFX's suggestion and it worked! Thanks mate!

El Forum

[eluser]RonMcClung[/eluser]
[quote author="ChaosKnight" date="1277124776"]I tried InsiteFX's suggestion and it worked! Thanks mate![/quote]

What suggestion was that? I am not seeing any suggestion here?

El Forum

[eluser]RonMcClung[/eluser]
I am still struggling with this same problem that the original poster was struggling wiht. I have set the port and the timeout and still get a time out from the server. I have done all I know to do? I am on a windows/IIS server, with SMTP authentication...

Any help here?