mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 13:00:54 +00:00
Emailer : Should use config Username only if no From is provided.
Should fix the case where Username is not an email.
This commit is contained in:
parent
2d87d4feaf
commit
9499b3eb90
@ -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