diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-11-08 23:15:08 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-11-08 23:15:08 +0100 |
commit | 04924b7a9d090c0814cfff3e6706263e4d5a46e8 (patch) | |
tree | d83fc6b5683fbc9c639bfd1832f96dca2f3c8646 /inc/mail.php | |
parent | 1ea7a6bada66fc9b7a45f61b4892e4ea23196d89 (diff) | |
parent | a731ed1d6736ca405b3559adfd9500affcc59412 (diff) | |
download | rpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.gz rpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.bz2 |
Merge branch 'master' into proxyconnect
* master: (169 commits)
added PCRE UTF-8 checks to do=check FS#2636
avoid multiple paralell update checks
fix regression bug in HTTPClient FS#2621
changed PAGEUTILS_ID_HIDEPAGE to has BEFORE/AFTER
TarLib code cleanup
TarLib: fixed appending in non-dynamic mode
fixed third method of adding files in TarLib
fix lone zero block in TarLib created archives
fix use of constructor in TarLib
Slovak language update
Korean language update
Latvian language update
added event PAGEUTILS_ID_HIDEPAGE
added test for isHiddenPage()
removed redundant variables in tpl_include_page() (because of 3ff8773b)
added cut off points for mobile devices as parameters to style.ini
Corrected typo: ruke -> rule
Persian language update
Spanish language update
russian language update
...
Diffstat (limited to 'inc/mail.php')
-rw-r--r-- | inc/mail.php | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/inc/mail.php b/inc/mail.php index bec0c5b10..d0ea651bf 100644 --- a/inc/mail.php +++ b/inc/mail.php @@ -32,20 +32,25 @@ if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', '[' /** * Prepare mailfrom replacement patterns * + * Also prepares a mailfromnobody config that contains an autoconstructed address + * if the mailfrom one is userdependent and this might not be wanted (subscriptions) + * * @author Andreas Gohr <andi@splitbrain.org> */ function mail_setup(){ global $conf; global $USERINFO; - $replace = array(); + // auto constructed address + $host = @parse_url(DOKU_URL,PHP_URL_HOST); + if(!$host) $host = 'example.com'; + $noreply = 'noreply@'.$host; + $replace = array(); if(!empty($USERINFO['mail'])){ $replace['@MAIL@'] = $USERINFO['mail']; }else{ - $host = @parse_url(DOKU_URL,PHP_URL_HOST); - if(!$host) $host = 'example.com'; - $replace['@MAIL@'] = 'noreply@'.$host; + $replace['@MAIL@'] = $noreply; } if(!empty($_SERVER['REMOTE_USER'])){ @@ -60,9 +65,18 @@ function mail_setup(){ $replace['@NAME@'] = ''; } - $conf['mailfrom'] = str_replace(array_keys($replace), - array_values($replace), - $conf['mailfrom']); + // apply replacements + $from = str_replace(array_keys($replace), + array_values($replace), + $conf['mailfrom']); + + // any replacements done? set different mailfromnone + if($from != $conf['mailfrom']){ + $conf['mailfromnobody'] = $noreply; + }else{ + $conf['mailfromnobody'] = $from; + } + $conf['mailfrom'] = $from; } /** |