Reputation: 385
I have the following:
config/email.php
$config['protocol'] = 'smtp';
$config['smtp_host'] = "xxxxxx";
$config['smtp_user'] = "xxxxxx";
$config['smtp_pass'] = "xxxxxx";
$config['smtp_port'] = xx;
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
So in most cases, I'm sending HTML with plain-text alternative emails. This config works perfectly.
Now in one special case, I'm wanting to send a plain-text email so I need to override that setting to:$config['mailtype'] = 'text';
How can I do that? I tried specifying a new config array and loading the library again but it still sends as HTML:
$email_config = Array(
'mailtype' => 'text'
);
$this->load->library('email', $email_config);
Upvotes: 1
Views: 779
Reputation: 832
You should use:
$config['mailtype'] = 'text';
$this->email->initialize($config);
Upvotes: 0
Reputation: 3343
I think you need to call initialize when you don't load from a config file.
$this->email->initialize($email_config);
Upvotes: 2