diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-11-30 12:30:40 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-11-30 12:30:40 +0100 |
commit | d14415e37072dbe16077efd700aee5bd33707b54 (patch) | |
tree | 062c3c190039ac9490f56598b0ee116de18c2480 /inc/mail.php | |
parent | 2ed38036a53a489d2fcadc46ce601f8c876fca31 (diff) | |
parent | 38479cbba628ee76a92ff5f3c974cfa8e6ce9e61 (diff) | |
download | rpg-d14415e37072dbe16077efd700aee5bd33707b54.tar.gz rpg-d14415e37072dbe16077efd700aee5bd33707b54.tar.bz2 |
Merge branch 'master' into subscription
* master: (175 commits)
some coding style improvements
added .idea project folder to gitignore
use correct setUp method and parent calls.
Correct German plugin manager translation (download != install)
correct return in sendDigest()
Fix case-insensitive match in ACL checking
GeSHi update to 1.0.8.11
ignore empty header on mail sending
remove empty BCC/CC mail headers
Galician language update
some welcome page changes
Combine subsequent calls to strtr into a single transformation
changed semicolon to colon in link to welcome page to make it less confusing
fixed wrong sidebar showing in namespaces when sidebar is disabled
Typo fix for TL;DR
removed a bunch of outdated and irrelevant networking acronyms
added another place to look for logo to make it more consistent (FS#2656)
French language update
Czech language update
compat js findPosX/y more closely mimic historical function
...
Conflicts:
inc/auth.php
inc/common.php
inc/subscription.php
lib/exe/indexer.php
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; } /** |