Last active
October 6, 2015 03:27
-
-
Save litzinger/2927711 to your computer and use it in GitHub Desktop.
Use hidden config, and actual CP setting in Email Configuration to send emails as whatever format the config value is set as. Ideal for sending notification emails as HTML.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function EE_initialize() | |
{ | |
$config = array( | |
'protocol' => ( ! in_array( $this->EE->config->item('mail_protocol'), $this->_protocols)) ? 'mail' : $this->EE->config->item('mail_protocol'), | |
'charset' => ($this->EE->config->item('email_charset') == '') ? 'utf-8' : $this->EE->config->item('email_charset'), | |
'smtp_host' => $this->EE->config->item('smtp_server'), | |
'smtp_user' => $this->EE->config->item('smtp_username'), | |
'smtp_pass' => $this->EE->config->item('smtp_password'), | |
'mailtype' => $this->EE->config->item('mail_format') | |
); | |
/* ------------------------------------------- | |
/* Hidden Configuration Variables | |
/* - email_newline => Default newline. | |
/* - email_crlf => CRLF used in quoted-printable encoding | |
/* - email_smtp_port => SMTP Port | |
/* -------------------------------------------*/ | |
if ($this->EE->config->item('email_newline') !== FALSE) | |
{ | |
$config['newline'] = $this->EE->config->item('email_newline'); | |
} | |
if ($this->EE->config->item('email_crlf') !== FALSE) | |
{ | |
$config['crlf'] = $this->EE->config->item('email_crlf'); | |
} | |
if ($this->EE->config->item('email_smtp_port') !== FALSE) | |
{ | |
$config['smtp_port'] = $this->EE->config->item('smtp_port'); | |
} | |
if ($this->EE->config->item('email_message_format') !== FALSE) | |
{ | |
$config['mailtype'] = $this->EE->config->item('email_message_format'); | |
} | |
$this->useragent = APP_NAME.' '.APP_VER; | |
$this->initialize($config); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment