Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ISPConfig 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Helmo
ISPConfig 3
Commits
0d68e921
Commit
0d68e921
authored
11 years ago
by
Marius Cramer
Browse files
Options
Downloads
Patches
Plain Diff
Fixed: FS#3318 - Check if there is a problem with bcc email addresses in email class
parent
ebd9b486
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
interface/lib/classes/ispcmail.inc.php
+79
-0
79 additions, 0 deletions
interface/lib/classes/ispcmail.inc.php
with
79 additions
and
0 deletions
interface/lib/classes/ispcmail.inc.php
+
79
−
0
View file @
0d68e921
...
@@ -638,7 +638,72 @@ class ispcmail {
...
@@ -638,7 +638,72 @@ class ispcmail {
return
true
;
return
true
;
}
}
private
function
_extract_names
(
$data
)
{
$senders
=
array
();
$data
=
stripslashes
(
preg_replace
(
"'(
\t
|
\r
|
\n
)'"
,
''
,
$data
));
if
(
trim
(
$data
)
==
''
)
return
$senders
;
$armail
=
array
();
$counter
=
0
;
$inthechar
=
0
;
$chartosplit
=
',;'
;
$protectchar
=
'"'
;
$temp
=
''
;
$closed
=
1
;
for
(
$i
=
0
;
$i
<
strlen
(
$data
);
$i
++
)
{
$thischar
=
$data
[
$i
];
if
(
$thischar
==
'<'
&&
$closed
)
$closed
=
0
;
if
(
$thischar
==
'>'
&&
!
$closed
)
$closed
=
1
;
if
(
$thischar
==
$protectchar
)
$inthechar
=
(
$inthechar
)
?
0
:
1
;
if
((
strpos
(
$chartosplit
,
$thischar
)
!==
false
)
&&
!
$inthechar
&&
$closed
)
{
$armail
[]
=
$temp
;
$temp
=
''
;
}
else
{
$temp
.
=
$thischar
;
}
}
if
(
trim
(
$temp
)
!=
''
)
{
$armail
[]
=
trim
(
$temp
);
unset
(
$temp
);
}
foreach
(
$armail
as
$thisPart
)
{
$thisPart
=
trim
(
preg_replace
(
'/^"(.*)"$/i'
,
'$1'
,
trim
(
$thisPart
)));
if
(
$thisPart
!=
''
)
{
$email
=
''
;
$name
=
''
;
if
(
preg_match
(
'/(.*)<(.*)>/i'
,
$thisPart
,
$matches
))
{
$email
=
trim
(
$matches
[
2
]);
$name
=
trim
(
$matches
[
1
]);
}
else
{
if
(
preg_match
(
'/([-a-z0-9_$+.]+@[-a-z0-9_.]+[-a-z0-9_]+)((.*))/i'
,
$thisPart
,
$matches
))
{
$email
=
$matches
[
1
];
$name
=
$matches
[
2
];
}
else
{
$email
=
$thisPart
;
}
}
$email
=
preg_replace
(
'/<(.*)\\>/'
,
'$1'
,
$email
);
$name
=
preg_replace
(
'/"(.*)"/'
,
'$1'
,
trim
(
$name
));
$name
=
preg_replace
(
'/\((.*)\)/'
,
'$1'
,
$name
);
if
(
$name
==
''
)
$name
=
$email
;
if
(
$email
==
''
)
$email
=
$name
;
$senders
[]
=
array
(
'name'
=>
$name
,
'mail'
=>
$email
);
unset
(
$name
);
unset
(
$email
);
}
}
unset
(
$armail
);
unset
(
$thisPart
);
return
$senders
;
}
/**
/**
* Send the mail to one or more recipients
* Send the mail to one or more recipients
...
@@ -683,6 +748,7 @@ class ispcmail {
...
@@ -683,6 +748,7 @@ class ispcmail {
$result
=
$this
->
_smtp_login
();
$result
=
$this
->
_smtp_login
();
if
(
!
$result
)
return
false
;
if
(
!
$result
)
return
false
;
}
}
$bcc_cc_sent
=
false
;
foreach
(
$recipients
as
$recipname
=>
$recip
)
{
foreach
(
$recipients
as
$recipname
=>
$recip
)
{
if
(
$this
->
_sent_mails
>=
$this
->
smtp_max_mails
)
{
if
(
$this
->
_sent_mails
>=
$this
->
smtp_max_mails
)
{
// close connection to smtp and reconnect
// close connection to smtp and reconnect
...
@@ -705,6 +771,19 @@ class ispcmail {
...
@@ -705,6 +771,19 @@ class ispcmail {
fputs
(
$this
->
_smtp_conn
,
'RCPT TO: <'
.
$recip
.
'>'
.
$this
->
_crlf
);
fputs
(
$this
->
_smtp_conn
,
'RCPT TO: <'
.
$recip
.
'>'
.
$this
->
_crlf
);
$response
=
fgets
(
$this
->
_smtp_conn
,
515
);
$response
=
fgets
(
$this
->
_smtp_conn
,
515
);
if
(
$bcc_cc_sent
==
false
)
{
$add_recips
=
array
();
if
(
$this
->
getHeader
(
'Cc'
)
!=
''
)
$add_recips
=
array_merge
(
$add_recips
,
$this
->
_extract_names
(
$this
->
getHeader
(
'Cc'
)));
if
(
$this
->
getHeader
(
'Bcc'
)
!=
''
)
$add_recips
=
array_merge
(
$add_recips
,
$this
->
_extract_names
(
$this
->
getHeader
(
'Bcc'
)));
foreach
(
$add_recips
as
$add_recip
)
{
if
(
!
$add_recip
[
'mail'
])
continue
;
fputs
(
$this
->
_smtp_conn
,
'RCPT TO: <'
.
$this
->
_encodeHeader
(
$add_recip
[
'mail'
],
$this
->
mail_charset
)
.
'>'
.
$this
->
_crlf
);
$response
=
fgets
(
$this
->
_smtp_conn
,
515
);
}
unset
(
$add_recips
);
$bcc_cc_sent
=
true
;
}
//The Email
//The Email
fputs
(
$this
->
_smtp_conn
,
'DATA'
.
$this
->
_crlf
);
fputs
(
$this
->
_smtp_conn
,
'DATA'
.
$this
->
_crlf
);
$response
=
fgets
(
$this
->
_smtp_conn
,
515
);
$response
=
fgets
(
$this
->
_smtp_conn
,
515
);
...
...
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