made it possible to disable HTML mails in the config

This commit is contained in:
Andreas Gohr 2012-04-15 13:25:05 +02:00
parent 052b2a1780
commit 2398a2b541
4 changed files with 11 additions and 0 deletions

View File

@ -101,6 +101,7 @@ $conf['notify'] = ''; //send change info to this email (leave
$conf['registernotify'] = ''; //send info about newly registered users to this email (leave blank for nobody)
$conf['mailfrom'] = ''; //use this email when sending mails
$conf['mailprefix'] = ''; //use this as prefix of outgoing mails
$conf['htmlmail'] = 1; //send HTML multipart mails
$conf['gzip_output'] = 0; //use gzip content encodeing for the output xhtml (if allowed by browser)
$conf['gdlib'] = 2; //the GDlib version (0, 1 or 2) 2 tries to autodetect
$conf['im_convert'] = ''; //path to ImageMagicks convert (will be used instead of GD)

View File

@ -26,6 +26,7 @@ class Mailer {
private $sendparam= null;
private $validator = null;
private $allowhtml = true;
/**
* Constructor
@ -43,6 +44,8 @@ class Mailer {
$listid = join('.',array_reverse(explode('/',DOKU_BASE))).$server;
$listid = strtolower(trim($listid,'.'));
$this->allowhtml = (bool) $conf['htmlmail'];
// add some default headers for mailfiltering FS#2247
$this->setHeader('X-Mailer','DokuWiki '.getVersion());
$this->setHeader('X-DokuWiki-User', $_SERVER['REMOTE_USER']);
@ -434,6 +437,11 @@ class Mailer {
protected function prepareBody(){
global $conf;
// no HTML mails allowed? remove HTML body
if(!$this->allowhtml){
$this->html = '';
}
// check for body
if(!$this->text && !$this->html){
return false;

View File

@ -127,6 +127,7 @@ $lang['notify'] = 'Send change notifications to this email address';
$lang['registernotify'] = 'Send info on newly registered users to this email address';
$lang['mailfrom'] = 'Email address to use for automatic mails';
$lang['mailprefix'] = 'Email subject prefix to use for automatic mails';
$lang['htmlmail'] = 'Send better looking but larger in size HTML multipart emails. Disable for plain text only mails.';
$lang['gzip_output'] = 'Use gzip Content-Encoding for xhtml';
$lang['gdlib'] = 'GD Lib version';
$lang['im_convert'] = 'Path to ImageMagick\'s convert tool';

View File

@ -179,6 +179,7 @@ $meta['fnencode'] = array('multichoice','_choices' => array('url','safe','utf
$meta['autoplural'] = array('onoff');
$meta['mailfrom'] = array('richemail');
$meta['mailprefix'] = array('string');
$meta['htmlmail'] = array('onoff');
$meta['compress'] = array('onoff');
$meta['cssdatauri'] = array('numeric','_pattern' => '/^\d+$/');
$meta['gzip_output'] = array('onoff');