Commit 9499b3eb authored by rahal's avatar rahal

Emailer : Should use config Username only if no From is provided.

Should fix the case where Username is not an email.
parent 2d87d4fe
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment