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
4de91f67
Commit
4de91f67
authored
Jan 25, 2016
by
miraclesu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show from when Config from is empty
parent
a80feb00
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
mail.go
utils/mail.go
+8
-5
No files found.
utils/mail.go
View file @
4de91f67
...
...
@@ -74,9 +74,6 @@ func NewEMail(config string) *Email {
if
err
!=
nil
{
return
nil
}
if
e
.
From
==
""
{
e
.
From
=
e
.
Username
}
return
e
}
...
...
@@ -228,13 +225,19 @@ func (e *Email) Send() error {
to
:=
make
([]
string
,
0
,
len
(
e
.
To
)
+
len
(
e
.
Cc
)
+
len
(
e
.
Bcc
))
to
=
append
(
append
(
append
(
to
,
e
.
To
...
),
e
.
Cc
...
),
e
.
Bcc
...
)
// Check to make sure there is at least one recipient and one "From" address
if
e
.
From
==
""
||
len
(
to
)
==
0
{
return
errors
.
New
(
"Must specify at least one
From address and one
To address"
)
if
len
(
to
)
==
0
{
return
errors
.
New
(
"Must specify at least one To address"
)
}
from
,
err
:=
mail
.
ParseAddress
(
e
.
Username
)
if
err
!=
nil
{
return
err
}
if
len
(
e
.
From
)
==
0
{
e
.
From
=
from
.
String
()
}
raw
,
err
:=
e
.
Bytes
()
if
err
!=
nil
{
return
err
...
...
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