diff options
author | Anika Henke <anika@selfthinker.org> | 2010-11-07 09:55:17 +0000 |
---|---|---|
committer | Anika Henke <anika@selfthinker.org> | 2010-11-07 09:55:17 +0000 |
commit | 23b10d5bcbfb9a11561296670425bc22665fb84c (patch) | |
tree | 745e07587c4f3feab0d56b9f9e1ed911b75511cc /inc/mail.php | |
parent | f5baf821ee5f6ab5b009bb94aff6f43f686d3329 (diff) | |
parent | 9c1c56fd8f997025e879c7a36f6d3c5022b925ae (diff) | |
download | rpg-23b10d5bcbfb9a11561296670425bc22665fb84c.tar.gz rpg-23b10d5bcbfb9a11561296670425bc22665fb84c.tar.bz2 |
Merge branch 'master' of github.com:splitbrain/dokuwiki
Diffstat (limited to 'inc/mail.php')
-rw-r--r-- | inc/mail.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/inc/mail.php b/inc/mail.php index 38232d110..fb163585a 100644 --- a/inc/mail.php +++ b/inc/mail.php @@ -30,7 +30,39 @@ if(!defined('QUOTEDPRINTABLE_EOL')) define('QUOTEDPRINTABLE_EOL',"\015\012"); if (!defined('RFC2822_ATEXT')) define('RFC2822_ATEXT',"0-9a-zA-Z!#$%&'*+/=?^_`{|}~-"); if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', '['.RFC2822_ATEXT.']+(?:\.['.RFC2822_ATEXT.']+)*@(?i:[0-9a-z][0-9a-z-]*\.)+(?i:[a-z]{2,4}|museum|travel)'); +/** + * Prepare mailfrom replacement patterns + * + * @author Andreas Gohr <andi@splitbrain.org> + */ +function mail_setup(){ + global $conf; + global $INFO; + + $replace = array(); + + if(!empty($INFO['userinfo']['mail'])){ + $replace['@MAIL@'] = $INFO['userinfo']['mail']; + }else{ + $replace['@MAIL@'] = 'noreply@'.parse_url(DOKU_URL,PHP_URL_HOST); + } + if(!empty($_SERVER['REMOTE_USER'])){ + $replace['@USER@'] = $_SERVER['REMOTE_USER']; + }else{ + $replace['@USER@'] = 'noreply'; + } + + if(!empty($INFO['userinfo']['name'])){ + $replace['@NAME@'] = $INFO['userinfo']['name']; + }else{ + $replace['@NAME@'] = ''; + } + + $conf['mailfrom'] = str_replace(array_keys($replace), + array_values($replace), + $conf['mailfrom']); +} /** * UTF-8 autoencoding replacement for PHPs mail function |