Page 1 of 1

email_api with HTML

Posted: 14 Jun 2013, 00:14
by dtamajon
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

Code: Select all

$g_email_is_html                = ON; # or OFF for plain-text; default is OFF
And then update this function to distinguish between plain-text or HTML new line.

Code: 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;
}
At the time, the config parameter is used to define sort of mail.

Code: Select all

$mail->IsHTML( config_get( 'email_is_html' )  );
I have attached complete email_api.php modified with all newline changes required. I hope it can help someone!!

Re: email_api with HTML

Posted: 14 Jun 2013, 06:43
by atrol