fix a couple more instances where we were still calling mail() directly for site critical messages

This commit is contained in:
zotlabs 2017-03-28 17:49:48 -07:00
parent 323ab3dba4
commit a54bb07753

View File

@ -2287,19 +2287,19 @@ function z_check_cert() {
*/ */
function cert_bad_email() { function cert_bad_email() {
return z_mail(
$email_tpl = get_intltext_template("cert_bad_eml.tpl"); [
$email_msg = replace_macros($email_tpl, array( 'toEmail' => \App::$config['system']['admin_email'],
'$sitename' => App::$config['system']['sitename'], 'messageSubject' => sprintf(t('[$Projectname] Website SSL error for %s'), App::get_hostname()),
'$siteurl' => z_root(), 'textVersion' => replace_macros(get_intltext_template('cert_bad_eml.tpl'),
'$error' => t('Website SSL certificate is not valid. Please correct.') [
)); '$sitename' => App::$config['system']['sitename'],
'$siteurl' => z_root(),
$subject = email_header_encode(sprintf(t('[$Projectname] Website SSL error for %s'), App::get_hostname())); '$error' => t('Website SSL certificate is not valid. Please correct.')
mail(App::$config['system']['admin_email'], $subject, $email_msg, ]
'From: Administrator' . '@' . App::get_hostname() . "\n" )
. 'Content-type: text/plain; charset=UTF-8' . "\n" ]
. 'Content-transfer-encoding: 8bit' ); );
} }
@ -2410,20 +2410,20 @@ function check_cron_broken() {
return; return;
} }
$email_tpl = get_intltext_template("cron_bad_eml.tpl"); return z_mail(
$email_msg = replace_macros($email_tpl, array( [
'$sitename' => App::$config['system']['sitename'], 'toEmail' => \App::$config['system']['admin_email'],
'$siteurl' => z_root(), 'messageSubject' => sprintf(t('[$Projectname] Cron tasks not running on %s'), App::get_hostname()),
'$error' => t('Cron/Scheduled tasks not running.'), 'textVersion' => replace_macros(get_intltext_template('cron_bad_eml.tpl'),
'$lastdate' => (($d)? $d : t('never')) [
)); '$sitename' => App::$config['system']['sitename'],
'$siteurl' => z_root(),
$subject = email_header_encode(sprintf(t('[$Projectname] Cron tasks not running on %s'), App::get_hostname())); '$error' => t('Cron/Scheduled tasks not running.'),
mail(App::$config['system']['admin_email'], $subject, $email_msg, '$lastdate' => (($d)? $d : t('never'))
'From: Administrator' . '@' . App::get_hostname() . "\n" ]
. 'Content-type: text/plain; charset=UTF-8' . "\n" )
. 'Content-transfer-encoding: 8bit' ); ]
return; );
} }