diff --git a/courier/smtp.go b/courier/smtp.go index 3de84b00384c..3c60b3361594 100644 --- a/courier/smtp.go +++ b/courier/smtp.go @@ -218,7 +218,7 @@ func (c *courier) dispatchEmail(ctx context.Context, msg Message) error { var mailErr *gomail.SendError switch { - case errors.As(err, &mailErr) && mailErr.Index >= 500: + case errors.As(err, &mailErr) && errors.As(mailErr.Cause, &protoErr) && protoErr.Code >= 500: fallthrough case errors.As(err, &protoErr) && protoErr.Code >= 500: // See https://en.wikipedia.org/wiki/List_of_SMTP_server_return_codes