mirror of
https://github.com/knadh/listmonk.git
synced 2025-01-01 11:45:01 +08:00
Add check to skip admin notifications with no e-mails. Closes #300.
This commit is contained in:
parent
c2a3f7d9d7
commit
51da1a16a0
1 changed files with 4 additions and 0 deletions
|
@ -22,6 +22,10 @@ type notifData struct {
|
||||||
|
|
||||||
// sendNotification sends out an e-mail notification to admins.
|
// sendNotification sends out an e-mail notification to admins.
|
||||||
func (app *App) sendNotification(toEmails []string, subject, tplName string, data interface{}) error {
|
func (app *App) sendNotification(toEmails []string, subject, tplName string, data interface{}) error {
|
||||||
|
if len(toEmails) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
if err := app.notifTpls.ExecuteTemplate(&b, tplName, data); err != nil {
|
if err := app.notifTpls.ExecuteTemplate(&b, tplName, data); err != nil {
|
||||||
app.log.Printf("error compiling notification template '%s': %v", tplName, err)
|
app.log.Printf("error compiling notification template '%s': %v", tplName, err)
|
||||||
|
|
Loading…
Reference in a new issue