Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Replace Username with FromEmail for warning email #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ type MailConf struct {
HttpAPI string
// 如果此时间段内没有邮件发送,则关闭 SMTP 连接,单位/秒
Keepalive int64
// sender email of warning email.
FromEmail string
*gomail.Dialer
}

Expand Down
4 changes: 3 additions & 1 deletion conf/files/mail.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
"Password": "nbhh",
"SSL": false,
"#LocalName": "LocalName is the hostname sent to the SMTP server with the HELO command. By default, 'localhost' is sent.",
"LocalName": "localhost"
"LocalName": "localhost",
"#FromEmail": "FromEmail is the email address of warning email sent from when warning email is enabled.",
"FromEmail": "no-reply@local.com"
}
2 changes: 1 addition & 1 deletion noticer.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (m *Mail) Serve() {
}

sm.Reset()
sm.SetHeader("From", m.cf.Username)
sm.SetHeader("From", m.cf.FromEmail)
sm.SetHeader("To", msg.To...)
sm.SetHeader("Subject", msg.Subject)
sm.SetBody("text/plain", msg.Body)
Expand Down