Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Merge requests
!79
An error occurred while fetching the assigned milestone of the selected merge_request.
Fix: Sent email is plain text if alternate text is empty
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fix: Sent email is plain text if alternate text is empty
ab_FixEmailAlternateText
into
devbranch
Overview
0
Commits
1
Pipelines
0
Changes
2
Merged
Akshay Bharambe
requested to merge
ab_FixEmailAlternateText
into
devbranch
5 years ago
Overview
0
Commits
1
Pipelines
0
Changes
2
Expand
Fix: Sent email is plain text if alternate text is empty
Add: Parse Plain text in normal v2 call
0
0
Merge request reports
Compare
devbranch
devbranch (base)
and
latest version
latest version
c7bdc0cf
1 commit,
5 years ago
2 files
+
18
−
4
Expand all files
Preferences
File browser
List view
Tree view
Compare changes
Inline
Side-by-side
Show whitespace changes
Show one file at a time
Search (e.g. *.vue) (Ctrl+P)
notificationmdl/email/email.go
+
11
−
2
Options
@@ -81,6 +81,11 @@ func (email *Email) SendMail(templateFilePath string, templateData interface{})
loggermdl
.
LogError
(
err
)
return
err
}
err
=
email
.
ParsePlainText
(
email
.
plainBody
,
templateData
)
if
errormdl
.
CheckErr
(
err
)
!=
nil
{
loggermdl
.
LogError
(
err
)
return
err
}
if
err
:=
email
.
Send
();
errormdl
.
CheckErr1
(
err
)
!=
nil
{
loggermdl
.
LogError
(
"error occured while calling SendMail: "
,
errormdl
.
CheckErr1
(
err
))
return
errormdl
.
Wrap
(
"Failed to send the email to: "
+
strings
.
Join
(
email
.
to
,
", "
))
@@ -147,8 +152,12 @@ func (email *Email) Send() error {
message
.
SetHeader
(
"Bcc"
,
email
.
bcc
...
)
message
.
SetHeader
(
"Subject"
,
email
.
subject
)
message
.
SetHeader
(
"Message-ID"
,
getMSGIDHeader
(
domain
,
guidmdl
.
GetGUID
()))
message
.
SetBody
(
"text/plain"
,
email
.
body
)
message
.
AddAlternative
(
"text/html"
,
email
.
plainBody
)
if
len
(
strings
.
TrimSpace
(
email
.
plainBody
))
==
0
{
message
.
SetBody
(
"text/html"
,
email
.
body
)
}
else
{
message
.
SetBody
(
"text/plain"
,
email
.
body
)
message
.
AddAlternative
(
"text/html"
,
email
.
plainBody
)
}
for
_
,
attachment
:=
range
email
.
attachments
{
message
.
Attach
(
attachment
)
// attach whatever you want
Menu
Explore
Projects
Groups
Topics
Snippets