summaryrefslogtreecommitdiff
path: root/inc/Mailer.class.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-03-09 12:44:28 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-03-09 12:44:28 +0100
commit9f3eca0b520fc5f689170108fbcbf490d12f2c2e (patch)
tree136343e3f3fe1b2bee92a126639c68aa087780b1 /inc/Mailer.class.php
parentd2113a3cac4f670858d94dc53de4f653828dac91 (diff)
downloadrpg-9f3eca0b520fc5f689170108fbcbf490d12f2c2e.tar.gz
rpg-9f3eca0b520fc5f689170108fbcbf490d12f2c2e.tar.bz2
Add various headers to the mails FS#2247. pull request #83 closed
Diffstat (limited to 'inc/Mailer.class.php')
-rw-r--r--inc/Mailer.class.php23
1 files changed, 16 insertions, 7 deletions
diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php
index 753ea3fd6..141b69a18 100644
--- a/inc/Mailer.class.php
+++ b/inc/Mailer.class.php
@@ -33,14 +33,23 @@ class Mailer {
* Initializes the boundary strings and part counters
*/
public function __construct(){
- if(isset($_SERVER['SERVER_NAME'])){
- $server = $_SERVER['SERVER_NAME'];
- }else{
- $server = 'localhost';
- }
+ global $conf;
+
+ $server = parse_url(DOKU_URL,PHP_URL_HOST);
$this->partid = md5(uniqid(rand(),true)).'@'.$server;
$this->boundary = '----------'.md5(uniqid(rand(),true));
+
+ $listid = join('.',array_reverse(explode('/',DOKU_BASE))).$server;
+ $listid = strtolower(trim($listid,'.'));
+
+ // add some default headers for mailfiltering FS#2247
+ $this->setHeader('X-Mailer','DokuWiki '.getVersion());
+ $this->setHeader('X-DokuWiki-User', $_SERVER['REMOTE_USER']);
+ $this->setHeader('X-DokuWiki-Title', $conf['title']);
+ $this->setHeader('X-DokuWiki-Server', $server);
+ $this->setHeader('X-Auto-Response-Suppress', 'OOF');
+ $this->setHeader('List-Id',$conf['title'].' <'.$listid.'>');
}
/**
@@ -114,10 +123,10 @@ class Mailer {
* @param bool $clean remove all non-ASCII chars and line feeds?
*/
public function setHeader($header,$value,$clean=true){
- $header = ucwords(strtolower($header)); // streamline casing
+ $header = str_replace(' ','-',ucwords(strtolower(str_replace('-',' ',$header)))); // streamline casing
if($clean){
$header = preg_replace('/[^\w \-\.\+\@]+/','',$header);
- $value = preg_replace('/[^\w \-\.\+\@]+/','',$value);
+ $value = preg_replace('/[^\w \-\.\+\@<>]+/','',$value);
}
// empty value deletes