~bigbes/core-go

1fd2476d29144d31b784b4248cd92ce47da23b9f — Simon Ser 3 years ago 2f23941
server/email: log missing mail::error-to, treat empty string as unset

Log a message when mail::error-to is unset, just in case the admin
forgot to set it. Don't try to parse an email address if error-to
is set to the empty string (the default value in the default config
file).
1 files changed, 3 insertions(+), 2 deletions(-)

M server/email.go
M server/email.go => server/email.go +3 -2
@@ 53,8 53,9 @@ func EmailRecover(ctx context.Context, _origErr interface{}) error {
		config.ServiceName(ctx), origErr))

	conf := config.ForContext(ctx)
	to, ok := conf.Get("mail", "error-to")
	if !ok {
	to, _ := conf.Get("mail", "error-to")
	if to == "" {
		log.Println("Warning: mail::error-to is not set")
		return fmt.Errorf("internal system error")
	}
	rcpt, err := gomail.ParseAddress(to)