Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
f7cefc02
Commit
f7cefc02
authored
12 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Patches
Plain Diff
added mailfromnone internal option FS#2170
parent
63e967bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inc/mail.php
+21
-7
21 additions, 7 deletions
inc/mail.php
with
21 additions
and
7 deletions
inc/mail.php
+
21
−
7
View file @
f7cefc02
...
...
@@ -32,20 +32,25 @@ if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', '['
/**
* Prepare mailfrom replacement patterns
*
* Also prepares a mailfromnone 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
[
'mailfromnone'
]
=
$noreply
;
}
else
{
$conf
[
'mailfromnone'
]
=
$from
;
}
$conf
[
'mailfrom'
]
=
$from
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment