mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 21:01:31 +00:00
Merge pull request #2184 from rahal/master
Emailer : Should use config Username only if no From is provided.
This commit is contained in:
commit
bba04dd864
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user