@@ -306,22 +306,22 @@ func (m *MailerImpl) sendOne(to []string, subject, msg string) error {
306306 return nil
307307}
308308
309- // RecoverableSMTPError is returned by SendMail when the server rejects a message
309+ // BadAddressSMTPError is returned by SendMail when the server rejects a message
310310// but for a reason that doesn't prevent us from continuing to send mail. The
311311// error message contains the error code and the error message returned from the
312312// server.
313- type RecoverableSMTPError struct {
313+ type BadAddressSMTPError struct {
314314 Message string
315315}
316316
317- func (e RecoverableSMTPError ) Error () string {
317+ func (e BadAddressSMTPError ) Error () string {
318318 return e .Message
319319}
320320
321321// Based on reading of various SMTP documents these are a handful
322322// of errors we are likely to be able to continue sending mail after
323323// receiving. The majority of these errors boil down to 'bad address'.
324- var recoverableErrorCodes = map [int ]bool {
324+ var badAddressErrorCodes = map [int ]bool {
325325 401 : true , // Invalid recipient
326326 422 : true , // Recipient mailbox is full
327327 441 : true , // Recipient server is not responding
@@ -377,9 +377,9 @@ func (m *MailerImpl) SendMail(to []string, subject, msg string) error {
377377 m .reconnect ()
378378 // After reconnecting, loop around and try `sendOne` again.
379379 continue
380- } else if errors .As (err , & protoErr ) && recoverableErrorCodes [protoErr .Code ] {
380+ } else if errors .As (err , & protoErr ) && badAddressErrorCodes [protoErr .Code ] {
381381 m .sendMailAttempts .WithLabelValues ("failure" , fmt .Sprintf ("SMTP %d" , protoErr .Code )).Inc ()
382- return RecoverableSMTPError {fmt .Sprintf ("%d: %s" , protoErr .Code , protoErr .Msg )}
382+ return BadAddressSMTPError {fmt .Sprintf ("%d: %s" , protoErr .Code , protoErr .Msg )}
383383 } else {
384384 // If it wasn't an EOF error or a recoverable SMTP error it is unexpected and we
385385 // return from SendMail() with the error
0 commit comments