Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
9499b3eb
Commit
9499b3eb
authored
Sep 27, 2016
by
rahal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Emailer : Should use config Username only if no From is provided.
Should fix the case where Username is not an email.
parent
2d87d4fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
mail.go
utils/mail.go
+6
-4
No files found.
utils/mail.go
View file @
9499b3eb
...
...
@@ -232,14 +232,16 @@ func (e *Email) Send() error {
return
errors
.
New
(
"Must specify at least one To address"
)
}
from
,
err
:=
mail
.
ParseAddress
(
e
.
Username
)
// Use the username if no From is provided
if
len
(
e
.
From
)
==
0
{
e
.
From
=
e
.
Username
}
from
,
err
:=
mail
.
ParseAddress
(
e
.
From
)
if
err
!=
nil
{
return
err
}
if
len
(
e
.
From
)
==
0
{
e
.
From
=
e
.
Username
}
// use mail's RFC 2047 to encode any string
e
.
Subject
=
qEncode
(
"utf-8"
,
e
.
Subject
)
...
...
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