问题描述:

I've put my email configurations in the config.php but I don't know how I can access them in my controller.

In my config.php:

/*EMAIL CONFIG*/

$config['protocol'] = 'smtp';

$config['smtp_host'] = 'ssl://smtp.googlemail.com';

$config['smtp_user'] = 'username';

$config['smtp_pass'] = 'pass';

$config['smtp_port'] = '465';

$config['mailtype'] = 'html';

Should I make an instance of the super global object?

Thanks in advance.

网友答案:

You can access it with:

$this->config->item('protocol');

Also, see the relevant chapter in CodeIgniter User Guide

网友答案:

You don't put email config settings in config.php. You make a new file called email.php and place it in the config folder. CI will automatically detect the email config setting from that file.

Look under "Setting Email Preferences in a Config File"

http://ellislab.com/codeigniter/user-guide/libraries/email.html

相关阅读:
Top