Text Formatted Code
/**
* Send an email.
*
* All emails sent by Geeklog are sent through this function now.
*
* @param to string recipients name and email address
* @param subject string subject of the email
* @param message string the text of the email
* @param from string (optional) sender of the the email
* @param html bool true if to be sent as an HTML email
* @param priority int add X-Priority header, if > 0
* @return boolean true if successful, otherwise false
*
*/
function COM_mail( $to, $subject, $message, $from = '', $html = false, $priority = 0 )
{
global $_CONF, $LANG_CHARSET;
static $mailobj;
if( function_exists( 'CUSTOM_mail' ))
{
return CUSTOM_mail( $to, $subject, $message, $from, $html, $priority );
}
include_once( 'Mail.php' );
include_once( 'Mail/RFC822.php' );
$method = $_CONF['mail_settings']['backend'];
if( !isset( $mailobj ))
{
if(( $method == 'sendmail' ) || ( $method == 'smtp' ))
{
$mailobj =& Mail::factory( $method, $_CONF['mail_settings'] );
}
else
{
$method = 'mail';
$mailobj =& Mail::factory( $method );
}
}
if( empty( $LANG_CHARSET ))
{
$charset = $_CONF['default_charset'];
if( empty( $charset ))
{
$charset = 'iso-8859-1';
}
}
else
{
$charset = $LANG_CHARSET;
}
if( empty( $from ))
{
$from = COM_formatEmailAddress( $_CONF['site_name'], $_CONF['site_mail']);
}
$headers = array();
$headers['From'] = $from;
if( $method != 'mail' )
{
$headers['To'] = $to;
}
$headers['Date'] = date( 'r' ); // RFC822 formatted date
if( $method == 'smtp' )
{
list( $usec, $sec ) = explode( ' ', microtime());
$m = substr( $usec, 2, 5 );
$headers['Message-Id'] = '<' . date( 'YmdHis' ) . '.' . $m
. '@' . $_CONF['mail_settings']['host'] . '>';
}
if( $html )
{
$headers['Content-Type'] = 'text/html; charset=' . $charset;
$headers['Content-Transfer-Encoding'] = '8bit';
}
else
{
$headers['Content-Type'] = 'text/plain; charset=' . $charset;
}
$headers['Subject'] = $subject;
if( $priority > 0 )
{
$headers['X-Priority'] = $priority;
}
$headers['X-Mailer'] = 'GeekLog ' . VERSION;
$retval = $mailobj->send( $to, $headers, $message );
if( $retval !== true )
{
COM_errorLog( $retval->toString(), 1 );
}
return( $retval === true ? true : false );
}
How do I format welcome_email.txt so that geeklog registers it as an html message, rather than plain text? Is there a way to change this code itself to force geeklog to send it as an html message?
I'm sorry I'm posting so much on this topic, I'm under deadline and my poking around isn't yealding any answers.