email_api with HTML
Posted: 14 Jun 2013, 00:14
I have done some modifications on core/email_api.php to accept html e-mails.
To do so, I have added the following parameter on config_inc.php
And then update this function to distinguish between plain-text or HTML new line.
At the time, the config parameter is used to define sort of mail.
I have attached complete email_api.php modified with all newline changes required. I hope it can help someone!!
To do so, I have added the following parameter on config_inc.php
Code: Select all
$g_email_is_html = ON; # or OFF for plain-text; default is OFFCode: Select all
/**
* clean up LF to CRLF
*
* @param string $p_string
* @return null
*/
function make_lf_crlf( $p_string ) {
$t_string = str_replace( "\n", "\r\n", $p_string );
$t_string = str_replace( "\r\r\n", "\r\n", $t_string );
if ( ON == config_get( 'email_is_html' ) ) {
$t_string = str_replace( "\r\n", "<br>", $t_string );
}
return $t_string;
}Code: Select all
$mail->IsHTML( config_get( 'email_is_html' ) );