Forums / Cotonti / Development / HTML Email

badsey
#1 2010-07-27 17:41
Is it possible to change the email that is sent from plain text to HTML so it can be themed to the site and if so could someone help me somehow :)
urlkiller
#2 2010-07-28 02:07
check this out:

functions.php line 3009:
/**
 * Sends mail with standard PHP mail()
 *
 * @global $cfg
 * @param string $fmail Recipient
 * @param string $subject Subject
 * @param string $body Message body
 * @param string $headers Message headers
 * @param string $additional_parameters Additional parameters passed to sendmail
 * @return bool
 */
function sed_mail($fmail, $subject, $body, $headers='', $additional_parameters = null)
{
	global $cfg;

	if(empty($fmail))
	{
		return(FALSE);
	}
	else
	{
		$headers = (empty($headers)) ? "From: \"".$cfg['maintitle']."\" <".$cfg['adminemail'].">\n"."Reply-To: <".$cfg['adminemail'].">\n" : $headers;
		$body .= "\n\n".$cfg['maintitle']." - ".$cfg['mainurl']."\n".$cfg['subtitle'];
		if($cfg['charset'] != 'us-ascii')
		{
			$headers .= "Content-Type: text/plain; charset=".$cfg['charset']."\n";
			$headers .= "Content-Transfer-Encoding: 8bit\n";
			$subject = mb_encode_mimeheader($subject, $cfg['charset'], 'B', "\n");
		}
		if(ini_get('safe_mode'))
		{
			mail($fmail, $subject, $body, $headers);
		}
		else
		{
			mail($fmail, $subject, $body, $headers, $additional_parameters);
		}
		sed_stat_inc('totalmailsent');
		return(TRUE);
	}
}

AND this here is the header for aregular HTML email:

MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1

but remember corehacking is not the best way of achiving a goal! for my example you need to change the charset and type in the system/functions.php on line 3009.
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
badsey
#3 2010-07-28 04:02
thank you so much :D, your a great help, :)

can i ask what would be the best way..?
urlkiller
#4 2010-07-28 10:37
the best way would be a plugin that hooks into the complete regitration process and enables the plugin user to have themable tpl files and a new email function that send the html (of course selecable wich kind in the config) ...

but "best way" could differ from person to person ;)
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>