CodeIgniter Forums
Blank page for Email test - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Blank page for Email test (/thread-43867.html)



Blank page for Email test - El Forum - 07-26-2011

[eluser]webnology[/eluser]
Hi all,

my app is running pretty fine now, without any errors. I'm trying to send emails, but I'm stuck. I only get a blank page, wothout errors, so it is kind of hard to foind out why it doens't send mails. Any reason why I get this blank page?

The environment is set as development, my log treshold is at 2.

Regards,
Michel


Blank page for Email test - El Forum - 07-26-2011

[eluser]webnology[/eluser]
This is the code

Code:
function sendTestMail {

        $this->load->library('email');
    
        $config['protocol']  = 'smtp';
        $config['smtp_host'] = 'mailing.example.com';
        $config['smtp_user'] = 'user';
        $config['smtp_pass'] = 'pwd';
    
        $this->email->initialize($config);

        $this->email->from('[email protected]', 'Someone');
        $this->email->to('[email protected]');
        $this->email->subject('Subject');
        $this->email->message('Test');
        $this->email->send();
    }

Should be fine, no?


Blank page for Email test - El Forum - 07-26-2011

[eluser]bubbafoley[/eluser]
add this at the end of the function to debug the email library

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



Blank page for Email test - El Forum - 07-27-2011

[eluser]webnology[/eluser]
Hi Bobbafoley,

thx for helping. I've added the rule, but still no results. Empty, white, blank page. No mail is sent. No errors.

Thsi is my full contrller, maybe you see sth wrong?

Code:
<?php

class Cron extends CI_Controller {

    //Constructor
    function __construct()
    {
        parent::__construct();
        
        $this->load->model('m_customers');
        $this->load->model('m_settings');
        $this->load->library('email');
    }
    
    function index() { }
    
    function sendTestMail() {

        $config['protocol']  = 'smtp';
        $config['smtp_host'] = 'host';
        $config['smtp_user'] = 'user';
        $config['smtp_pass'] = 'pwd';
    
        $this->email->initialize($config);

        $this->email->from('[email protected]', 'Sender');
        $this->email->to('[email protected]');
        $this->email->subject('Subject');
        $this->email->message('Test');
        $this->email->send();
        
        echo $this->email->print_debugger();  
    }
}



Blank page for Email test - El Forum - 07-27-2011

[eluser]angeljaky[/eluser]
thanks for this extension. I am using it on our laboratory wiki after some simplification.
It works well except that we cannot send japanese character which is a stopover because mainly the wiki is used in japanese. I saw that it is already in the known bugs and I would like to know if there is a workaround (like specifying the encoding of the email??). I could send some well encoding character emails but I cannot reproduce it, I am investigating it now.
Also I am working on the translation of th i18n in japanese, should I post it here?
Thanks for your help. Sylvain 9:05, 3 March 2009 (UTC)
It seems that the mails are send in UTF-8 but it is not detected. Perhaps should add it in the header... I will check if it is possible.
Found a fix just need to line 50 in class.phpmailer.php to

funnt picture


Blank page for Email test - El Forum - 07-27-2011

[eluser]webnology[/eluser]
Strange, if I put the exact same function in another controller, it works fine. I've chagend the name of the controller from Cron to Mails, maybe that helps, but no result. Any idea someone?


Blank page for Email test - El Forum - 07-27-2011

[eluser]webnology[/eluser]
Got it. One of the Models I was calling was not correctly extended.

Cheers,
M