1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

Add FromAlias to the Mail service and some iriscontrol fixes

This commit is contained in:
Makis Maropoulos
2016-06-06 13:25:09 +03:00
parent 48aaca5bc0
commit 86694df84e
7 changed files with 38 additions and 11 deletions

View File

@@ -33,9 +33,12 @@ type (
func New(cfg config.Mail) Service {
m := &mailer{config: cfg}
// not necessary
if !cfg.UseCommand && cfg.Username != "" && strings.Contains(cfg.Username, "@") {
m.fromAddr = mail.Address{cfg.Username[0:strings.IndexByte(cfg.Username, '@')], cfg.Username}
if cfg.FromAlias == "" {
if !cfg.UseCommand && cfg.Username != "" && strings.Contains(cfg.Username, "@") {
m.fromAddr = mail.Address{cfg.Username[0:strings.IndexByte(cfg.Username, '@')], cfg.Username}
}
} else {
m.fromAddr = mail.Address{cfg.FromAlias, cfg.Username}
}
return m