CodeIgniter Forums

Full Version: Email function doesn't work since 3 septembre 2015
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I build a php-sql website based on CodeIgniter 3 years ago.
I don't remeber the CI version, how can i know that ?

So since the september 3rd 2015, no email are sent with the email library of CI...

I tried the simply test :

PHP Code:
$this->load->library('email');

$this->email->from('[email protected]''Your Name');
$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(); 

but nothing happens.

Someone has an idea to fix or to try to debug ?

Thanks a lot and sorry for my poor english... Sad

Paco
See the mail server logs.

Debug, you can:

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

I do this:

application/config/email.php


PHP Code:
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n"

In the controller:

PHP Code:
$this->load->library('email'); 

PHP Code:
$this->email->from('[email protected]','From Title');
$this->email->to('[email protected]'); 
$this->email->subject('Hello Admin!'); 
$this->email->message('Message hello!'); 
$this->email->send(); 
Thanks but still bugging...

I don't have a application/config/email.php in my files (maybe a very old CI version).

But I test this :
PHP Code:
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";

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

$this->load->library('email');

$this->email->from('[email protected]','From Title');
$this->email->to('[email protected]'); 
$this->email->subject('Hello Admin!'); 
$this->email->message('Message hello!'); 
$this->email->send();

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

No email received... Sad

The debug trace after :
Quote:Votre message a bien été expédié via le protocole suivant : mail
User-Agent: CodeIgniter
Date: Sat, 21 Nov 2015 22:33:24 +0100
From: "From Title"
Return-Path:
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_5650e324d1f39"


=?utf-8?Q?Hello_Admin!?=
This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_5650e324d1f39
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Message hello!


--B_ALT_5650e324d1f39
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Message hello!

--B_ALT_5650e324d1f39--

Thanks for help.

Paco
(11-21-2015, 02:35 PM)pcayrol Wrote: [ -> ]I don't have a application/config/email.php in my files (maybe a very old CI version).

By default this file is not present. You can create it. The file will automatically run.

I made a simple test runs.

PHP Code:
defined('BASEPATH') OR exit('No direct script access allowed');

class 
Test extends CI_Controller {
    
    
    function 
__construct()     {
        
parent::__construct();
        
$this->load->library('email');
    }
    
    public function 
index() {

        
$config['mailtype'] = 'html';
        
$config['charset'] = 'utf-8';
        
$config['newline'] = "\r\n";

        
$this->email->initialize($config);
    
        
$this->email->from('[email protected]','From Title condor');
        
$this->email->to('[email protected]'); 
        
$this->email->subject('Hello!'); 
        
$this->email->message('Message hello condor!'); 
        
$this->email->send();

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

    }
    

You're not supposed to send @codeigniter.com emails ...
> I don't remeber the CI version, how can i know that ?

PHP Code:
echo CI_VERSION
(11-22-2015, 05:32 AM)Narf Wrote: [ -> ]You're not supposed to send @codeigniter.com emails ...

Sorry I just forgotone time to put my email address ? But that's mean do you receive an email from my test ? (that's would mean the problem is my email ???)
(11-22-2015, 02:55 PM)pcayrol Wrote: [ -> ]
(11-22-2015, 05:32 AM)Narf Wrote: [ -> ]You're not supposed to send @codeigniter.com emails ...

Sorry I just forgotone time to put my email address ? But that's mean do you receive an email from my test ? (that's would mean the problem is my email ???)

No, I don't. Quite the opposite ... your emails may be blocked because you're trying to spoof the domain.
Hello again...

I understood the problem : my hotmail (outlook.com) address reject all emails from my website... And that since exactly the september 3rd 2015.
I lokk my Outlook options but I didn't find something.

So I test with gmail address and it works Smile

Thanks for your help.

Paco