summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-04-15 13:25:05 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-04-15 13:25:05 +0200
commit2398a2b54196667d6659d3d0489212b271c43703 (patch)
tree3510bf81289d4c93f1c801fb270a9db01ec0d926
parent052b2a1780ce07c45e80cd16a55e43177850de35 (diff)
downloadrpg-2398a2b54196667d6659d3d0489212b271c43703.tar.gz
rpg-2398a2b54196667d6659d3d0489212b271c43703.tar.bz2
made it possible to disable HTML mails in the config
-rw-r--r--conf/dokuwiki.php1
-rw-r--r--inc/Mailer.class.php8
-rw-r--r--lib/plugins/config/lang/en/lang.php1
-rw-r--r--lib/plugins/config/settings/config.metadata.php1
4 files changed, 11 insertions, 0 deletions
diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php
index 298c8e572..fddc38a91 100644
--- a/conf/dokuwiki.php
+++ b/conf/dokuwiki.php
@@ -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)
diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php
index 9744fa44e..f04cdd3e2 100644
--- a/inc/Mailer.class.php
+++ b/inc/Mailer.class.php
@@ -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;
diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php
index 380f2fd1d..fc27e5158 100644
--- a/lib/plugins/config/lang/en/lang.php
+++ b/lib/plugins/config/lang/en/lang.php
@@ -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';
diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php
index 5f2c32ea7..60ea6a4c2 100644
--- a/lib/plugins/config/settings/config.metadata.php
+++ b/lib/plugins/config/settings/config.metadata.php
@@ -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');