chchrist
chchrist

Reputation: 19822

Code Igniter email config to config.php

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.

Upvotes: 2

Views: 5961

Answers (2)

bradhanks
bradhanks

Reputation: 422

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

Upvotes: 6

Bogdan
Bogdan

Reputation: 5406

You can access it with:

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

Also, see the relevant chapter in CodeIgniter User Guide

Upvotes: 2

Related Questions