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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
26a693ad
Commit
26a693ad
authored
Jan 02, 2016
by
Dylan Hardison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1235395 - whine.pl broken due to a missing generate_email() routine
r=lpsolit,a=dylan
parent
15cc0879
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
2 deletions
+67
-2
Mailer.pm
Bugzilla/Mailer.pm
+67
-1
Product.pm
Bugzilla/Product.pm
+0
-1
No files found.
Bugzilla/Mailer.pm
View file @
26a693ad
...
...
@@ -12,13 +12,14 @@ use strict;
use
warnings
;
use
parent
qw(Exporter)
;
@
Bugzilla::Mailer::
EXPORT
=
qw(MessageToMTA build_thread_marker)
;
@
Bugzilla::Mailer::
EXPORT
=
qw(MessageToMTA build_thread_marker
generate_email
)
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Error
;
use
Bugzilla::
Hook
;
use
Bugzilla::
MIME
;
use
Bugzilla::
Util
;
use
Bugzilla::
User
;
use
Date::
Format
qw(time2str)
;
...
...
@@ -26,6 +27,67 @@ use Email::Sender::Simple qw(sendmail);
use
Email::Sender::Transport::SMTP::
Persistent
;
use
Bugzilla::Sender::Transport::
Sendmail
;
sub
generate_email
{
my
(
$vars
,
$templates
)
=
@_
;
my
(
$lang
,
$email_format
,
$msg_text
,
$msg_html
,
$msg_header
);
state
$use_utf8
=
Bugzilla
->
params
->
{
'utf8'
};
if
(
$vars
->
{
to_user
})
{
$lang
=
$vars
->
{
to_user
}
->
setting
(
'lang'
);
$email_format
=
$vars
->
{
to_user
}
->
setting
(
'email_format'
);
}
else
{
# If there are users in the CC list who don't have an account,
# use the default language for email notifications.
$lang
=
Bugzilla::
User
->
new
()
->
setting
(
'lang'
);
# However we cannot fall back to the default email_format, since
# it may be HTML, and many of the includes used in the HTML
# template require a valid user object. Instead we fall back to
# the plaintext template.
$email_format
=
'text_only'
;
}
my
$template
=
Bugzilla
->
template_inner
(
$lang
);
$template
->
process
(
$templates
->
{
header
},
$vars
,
\
$msg_header
)
||
ThrowTemplateError
(
$template
->
error
());
$template
->
process
(
$templates
->
{
text
},
$vars
,
\
$msg_text
)
||
ThrowTemplateError
(
$template
->
error
());
my
@parts
=
(
Bugzilla::
MIME
->
create
(
attributes
=>
{
content_type
=>
'text/plain'
,
charset
=>
$use_utf8
?
'UTF-8'
:
'iso-8859-1'
,
encoding
=>
'quoted-printable'
,
},
body_str
=>
$msg_text
,
)
);
if
(
$templates
->
{
html
}
&&
$email_format
eq
'html'
)
{
$template
->
process
(
$templates
->
{
html
},
$vars
,
\
$msg_html
)
||
ThrowTemplateError
(
$template
->
error
());
push
@parts
,
Bugzilla::
MIME
->
create
(
attributes
=>
{
content_type
=>
'text/html'
,
charset
=>
$use_utf8
?
'UTF-8'
:
'iso-8859-1'
,
encoding
=>
'quoted-printable'
,
},
body_str
=>
$msg_html
,
);
}
my
$email
=
Bugzilla::
MIME
->
new
(
$msg_header
);
if
(
scalar
(
@parts
)
==
1
)
{
$email
->
content_type_set
(
$parts
[
0
]
->
content_type
);
}
else
{
$email
->
content_type_set
(
'multipart/alternative'
);
# Some mail clients need same encoding for each part, even empty ones.
$email
->
charset_set
(
'UTF-8'
)
if
$use_utf8
;
}
$email
->
parts_set
(
\
@parts
);
return
$email
;
}
sub
MessageToMTA
{
my
(
$msg
,
$send_now
)
=
(
@_
);
my
$method
=
Bugzilla
->
params
->
{
'mail_delivery_method'
};
...
...
@@ -173,6 +235,10 @@ Bugzilla::Mailer - Provides methods for sending email
=over
=item C<generate_email>
Generates a multi-part email message, using the supplied list of templates.
=item C<MessageToMTA>
Sends the passed message to the mail transfer agent.
...
...
Bugzilla/Product.pm
View file @
26a693ad
...
...
@@ -22,7 +22,6 @@ use Bugzilla::Milestone;
use
Bugzilla::
Field
;
use
Bugzilla::
Status
;
use
Bugzilla::Install::
Requirements
;
use
Bugzilla::
Mailer
;
use
Bugzilla::
Series
;
use
Bugzilla::
Hook
;
use
Bugzilla::
FlagType
;
...
...
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