Welcome Guest, Not a member yet? Register   Sign In
Extended Email Library not using the email.php config
#1

[eluser]Gram3000[/eluser]
Hi,

I recently created a My_email.php file to extend the native Email library so that I could add additional headers to outgoing emails.

It is working well, I can see the additional headers in the outgoing emails. However, The settings I have in place in the config/email.php file are no longer being used at all.

I can fix this by adding the email config settings directly in to the controller but that isn't an ideal solution as I would need to update several functions.

Does anyone know if it is possible to extend the Email library to add headers but also remain using the config/email.php settings?

Thank you.
#2

[eluser]TheFuzzy0ne[/eluser]
Yes, it's possible.

I suspect your problem is that you're not passing on the constructor parameters to your inheriting class. The top of your class should look like this:

Code:
class MY_Email extends CI_Email {

    function __construct($config = array())
    {
        parent::__construct($config),
    }

The settings in your configuration file should now be passed through to your class.




Theme © iAndrew 2016 - Forum software by © MyBB