Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
5d96fa70
Commit
5d96fa70
authored
Sep 20, 2014
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 502625: Replace Email::Send with Email::Sender
r=dylan a=glob
parent
917ede93
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
73 deletions
+41
-73
Config.pm
Bugzilla/Config.pm
+13
-10
MTA.pm
Bugzilla/Config/MTA.pm
+1
-10
Hook.pm
Bugzilla/Hook.pm
+0
-3
Requirements.pm
Bugzilla/Install/Requirements.pm
+4
-12
Mailer.pm
Bugzilla/Mailer.pm
+21
-36
mta.html.tmpl
template/en/default/admin/params/mta.html.tmpl
+2
-2
No files found.
Bugzilla/Config.pm
View file @
5d96fa70
...
...
@@ -185,16 +185,19 @@ sub update_params {
}
# Old mail_delivery_method choices contained no uppercase characters
if
(
exists
$param
->
{
'mail_delivery_method'
}
&&
$param
->
{
'mail_delivery_method'
}
!~
/[A-Z]/
)
{
my
$method
=
$param
->
{
'mail_delivery_method'
};
my
%
translation
=
(
'sendmail'
=>
'Sendmail'
,
'smtp'
=>
'SMTP'
,
'qmail'
=>
'Qmail'
,
'testfile'
=>
'Test'
,
'none'
=>
'None'
);
$param
->
{
'mail_delivery_method'
}
=
$translation
{
$method
};
my
$mta
=
$param
->
{
'mail_delivery_method'
};
if
(
$mta
)
{
if
(
$mta
!~
/[A-Z]/
)
{
my
%
translation
=
(
'sendmail'
=>
'Sendmail'
,
'smtp'
=>
'SMTP'
,
'qmail'
=>
'Qmail'
,
'testfile'
=>
'Test'
,
'none'
=>
'None'
);
$param
->
{
'mail_delivery_method'
}
=
$translation
{
$mta
};
}
# This will force the parameter to be reset to its default value.
delete
$param
->
{
'mail_delivery_method'
}
if
$param
->
{
'mail_delivery_method'
}
eq
'Qmail'
;
}
# Convert the old "ssl" parameter to the new "ssl_redirect" parameter.
...
...
Bugzilla/Config/MTA.pm
View file @
5d96fa70
...
...
@@ -12,13 +12,6 @@ use strict;
use
warnings
;
use
Bugzilla::Config::
Common
;
# Return::Value 1.666002 pollutes the error log with warnings about this
# deprecated module. We have to set NO_CLUCK = 1 before loading Email::Send
# to disable these warnings.
BEGIN
{
$
Return::Value::
NO_CLUCK
=
1
;
}
use
Email::
Send
;
our
$sortkey
=
1200
;
...
...
@@ -28,9 +21,7 @@ sub get_param_list {
{
name
=>
'mail_delivery_method'
,
type
=>
's'
,
# Bugzilla is not ready yet to send mails to newsgroups, and 'IO'
# is of no use for now as we already have our own 'Test' mode.
choices
=>
[
grep
{
$_
ne
'NNTP'
&&
$_
ne
'IO'
}
Email::
Send
->
new
()
->
all_mailers
(),
'None'
],
choices
=>
[
'Sendmail'
,
'SMTP'
,
'Test'
,
'None'
],
default
=>
'Sendmail'
,
checker
=>
\&
check_mail_delivery_method
},
...
...
Bugzilla/Hook.pm
View file @
5d96fa70
...
...
@@ -1033,9 +1033,6 @@ Params:
=item C<email> - The C<Email::MIME> object that's about to be sent.
=item C<mailer_args> - An arrayref that's passed as C<mailer_args> to
L<Email::Send/new>.
=back
=head2 object_before_create
...
...
Bugzilla/Install/Requirements.pm
View file @
5d96fa70
...
...
@@ -23,13 +23,6 @@ use Bugzilla::Install::Util qw(install_string bin_loc
use
List::
Util
qw(max)
;
use
Term::
ANSIColor
;
# Return::Value 1.666002 pollutes the error log with warnings about this
# deprecated module. We have to set NO_CLUCK = 1 before loading Email::Send
# in have_vers() to disable these warnings.
BEGIN
{
$
Return::Value::
NO_CLUCK
=
1
;
}
use
parent
qw(Exporter)
;
our
@EXPORT
=
qw(
REQUIRED_MODULES
...
...
@@ -131,12 +124,11 @@ sub REQUIRED_MODULES {
module
=>
'Template'
,
version
=>
'2.24'
},
#
2.04 implement the "Test" method (to write to data/mailer.testfile)
.
#
1.300011 has a debug mode for SMTP and automatically pass -i to sendmail
.
{
package
=>
'Email-Send'
,
module
=>
'Email::Send'
,
version
=>
ON_WINDOWS
?
'2.16'
:
'2.04'
,
blacklist
=>
[
'^2\.196$'
]
package
=>
'Email-Sender'
,
module
=>
'Email::Sender'
,
version
=>
'1.300011'
,
},
{
package
=>
'Email-MIME'
,
...
...
Bugzilla/Mailer.pm
View file @
5d96fa70
...
...
@@ -23,15 +23,10 @@ use Date::Format qw(time2str);
use
Encode
qw(encode)
;
use
Encode::MIME::
Header
;
use
Email::
Address
;
use
Email::
MIME
;
# Return::Value 1.666002 pollutes the error log with warnings about this
# deprecated module. We have to set NO_CLUCK = 1 before loading Email::Send
# to disable these warnings.
BEGIN
{
$
Return::Value::
NO_CLUCK
=
1
;
}
use
Email::
Send
;
use
Email::Sender::
Simple
qw(sendmail)
;
use
Email::Sender::Transport::
SMTP
;
use
Email::Sender::Transport::
Sendmail
;
sub
MessageToMTA
{
my
(
$msg
,
$send_now
)
=
(
@_
);
...
...
@@ -55,8 +50,6 @@ sub MessageToMTA {
# Email::MIME doesn't do this for us. We use \015 (CR) and \012 (LF)
# directly because Perl translates "\n" depending on what platform
# you're running on. See http://perldoc.perl.org/perlport.html#Newlines
# We check for multiple CRs because of this Template-Toolkit bug:
# https://rt.cpan.org/Ticket/Display.html?id=43345
$msg
=~
s/(?:\015+)?\012/\015\012/msg
;
$email
=
new
Email::
MIME
(
$msg
);
}
...
...
@@ -108,21 +101,14 @@ sub MessageToMTA {
my
$from
=
$email
->
header
(
'From'
);
my
(
$hostname
,
@args
)
;
my
$
mailer_class
=
$method
;
my
$hostname
;
my
$
transport
;
if
(
$method
eq
"Sendmail"
)
{
$mailer_class
=
'Bugzilla::Send::Sendmail'
;
if
(
ON_WINDOWS
)
{
$
Email::Send::Sendmail::
SENDMAIL
=
SENDMAIL_EXE
;
$
transport
=
Email::Sender::Transport::
Sendmail
->
new
({
sendmail
=>
SENDMAIL_EXE
})
;
}
push
@args
,
"-i"
;
# We want to make sure that we pass *only* an email address.
if
(
$from
)
{
my
(
$email_obj
)
=
Email::
Address
->
parse
(
$from
);
if
(
$email_obj
)
{
my
$from_email
=
$email_obj
->
address
;
push
(
@args
,
"-f$from_email"
)
if
$from_email
;
}
else
{
$transport
=
Email::Sender::Transport::
Sendmail
->
new
();
}
}
else
{
...
...
@@ -141,16 +127,16 @@ sub MessageToMTA {
}
if
(
$method
eq
"SMTP"
)
{
push
@args
,
Host
=>
Bugzilla
->
params
->
{
"smtpserver"
},
username
=>
Bugzilla
->
params
->
{
"smtp_username"
},
password
=>
Bugzilla
->
params
->
{
"smtp_password"
},
Hello
=>
$hostname
,
ssl
=>
Bugzilla
->
params
->
{
'smtp_ssl'
},
Debug
=>
Bugzilla
->
params
->
{
'smtp_debug'
};
$transport
=
Email::Sender::Transport::
SMTP
->
new
({
host
=>
Bugzilla
->
params
->
{
'smtpserver'
},
sasl_username
=>
Bugzilla
->
params
->
{
'smtp_username'
},
sasl_password
=>
Bugzilla
->
params
->
{
'smtp_password'
},
helo
=>
$hostname
,
ssl
=>
Bugzilla
->
params
->
{
'smtp_ssl'
},
debug
=>
Bugzilla
->
params
->
{
'smtp_debug'
}
});
}
Bugzilla::Hook::
process
(
'mailer_before_send'
,
{
email
=>
$email
,
mailer_args
=>
\
@args
});
Bugzilla::Hook::
process
(
'mailer_before_send'
,
{
email
=>
$email
});
return
if
$email
->
header
(
'to'
)
eq
''
;
...
...
@@ -185,13 +171,12 @@ sub MessageToMTA {
close
TESTFILE
;
}
else
{
# This is useful for
both Sendmail and Q
mail, so we put it out here.
# This is useful for
Send
mail, so we put it out here.
local
$ENV
{
PATH
}
=
SENDMAIL_PATH
;
my
$mailer
=
Email::
Send
->
new
({
mailer
=>
$mailer_class
,
mailer_args
=>
\
@args
});
my
$retval
=
$mailer
->
send
(
$email
);
ThrowCodeError
(
'mail_send_error'
,
{
msg
=>
$retval
,
mail
=>
$email
})
if
!
$retval
;
eval
{
sendmail
(
$email
,
{
transport
=>
$transport
})
};
if
(
$@
)
{
ThrowCodeError
(
'mail_send_error'
,
{
msg
=>
$@
->
message
,
mail
=>
$email
});
}
}
}
...
...
template/en/default/admin/params/mta.html.tmpl
View file @
5d96fa70
...
...
@@ -14,7 +14,7 @@
mail_delivery_method => "Defines how email is sent, or if it is sent at all.<br>
<ul>
<li>
'Sendmail'
, 'SMTP' and 'Qmail' are all
MTAs.
'Sendmail'
and 'SMTP' are both
MTAs.
You need to install a third-party sendmail replacement if
you want to use sendmail on Windows.
</li>
...
...
@@ -23,7 +23,7 @@
in 'data/mailer.testfile' instead of being sent.
</li>
<li>
'
n
one' will completely disable email. Bugzilla continues
'
N
one' will completely disable email. Bugzilla continues
to act as though it is sending mail, but nothing is sent or
stored.
</li>
...
...
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