Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
10a1ed12
Commit
10a1ed12
authored
Nov 12, 2009
by
Andrew Robert Nicols
Committed by
Richard Mansfield
Nov 20, 2009
Browse files
Generate an email address for bounce processing
Signed-off-by:
Andrew Robert Nicols
<
andrew.nicols@luns.net.uk
>
parent
b6c4f0ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/user.php
View file @
10a1ed12
...
@@ -342,9 +342,14 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='',
...
@@ -342,9 +342,14 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='',
}
}
}
}
if
(
get_config
(
'bounces_handle'
)
&&
isset
(
$mailinfo
->
owner
))
{
$mail
->
Sender
=
generate_email_processing_address
(
$mailinfo
->
owner
,
$userto
);
}
if
(
empty
(
$userfrom
)
||
$userfrom
->
email
==
get_config
(
'noreplyaddress'
))
{
if
(
empty
(
$userfrom
)
||
$userfrom
->
email
==
get_config
(
'noreplyaddress'
))
{
$mail
->
Sender
=
get_config
(
'noreplyaddress'
);
if
(
empty
(
$mail
->
Sender
))
{
$mail
->
From
=
$mail
->
Sender
;
$mail
->
Sender
=
get_config
(
'noreplyaddress'
);
}
$mail
->
From
=
get_config
(
'noreplyaddress'
);
$mail
->
FromName
=
(
isset
(
$userfrom
->
id
))
?
display_name
(
$userfrom
,
$userto
)
:
get_config
(
'sitename'
);
$mail
->
FromName
=
(
isset
(
$userfrom
->
id
))
?
display_name
(
$userfrom
,
$userto
)
:
get_config
(
'sitename'
);
$customheaders
[]
=
'Precedence: Bulk'
;
// Try to avoid pesky out of office responses
$customheaders
[]
=
'Precedence: Bulk'
;
// Try to avoid pesky out of office responses
$messagetext
.
=
"
\n\n
"
.
get_string
(
'pleasedonotreplytothismessage'
)
.
"
\n
"
;
$messagetext
.
=
"
\n\n
"
.
get_string
(
'pleasedonotreplytothismessage'
)
.
"
\n
"
;
...
@@ -353,8 +358,10 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='',
...
@@ -353,8 +358,10 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='',
}
}
}
}
else
{
else
{
$mail
->
Sender
=
$userfrom
->
email
;
if
(
empty
(
$mail
->
Sender
))
{
$mail
->
From
=
$mail
->
Sender
;
$mail
->
Sender
=
$userfrom
->
email
;
}
$mail
->
From
=
$userfrom
->
email
;
$mail
->
FromName
=
display_name
(
$userfrom
,
$userto
);
$mail
->
FromName
=
display_name
(
$userfrom
,
$userto
);
}
}
$replytoset
=
false
;
$replytoset
=
false
;
...
@@ -442,6 +449,24 @@ function can_receive_email($userto) {
...
@@ -442,6 +449,24 @@ function can_receive_email($userto) {
return
$mailinfo
;
return
$mailinfo
;
}
}
/**
* Generate an email processing address for VERP handling of email
*
* @param int $userid the ID of the user sending the mail
* @param object $userto an object containing the email address
* @param char $type The type of address to generate
*
* The type of address is typically a Bounce. These are processed by the
* process_email function.
*/
function
generate_email_processing_address
(
$userid
,
$userto
,
$type
=
'B'
)
{
$mailprefix
=
get_config
(
'bounceprefix'
);
$maildomain
=
get_config
(
'bouncedomain'
);
$installation_key
=
get_config
(
'installation_key'
);
$args
=
$type
.
base64_encode
(
pack
(
'V'
,
$userid
))
.
substr
(
md5
(
$userto
->
email
),
0
,
16
);
return
$mailprefix
.
$args
.
substr
(
md5
(
$mailprefix
.
$userto
->
email
.
$installation_key
),
0
,
16
)
.
'@'
.
$maildomain
;
}
/**
/**
* Update the send count for the specified e-mail address
* Update the send count for the specified e-mail address
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment