mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-23 22:20:51 +01:00
Enhance error handling with ENHANCEDSTATUSCODES check
Added a check for the ENHANCEDSTATUSCODES extension and included error code and enhanced status code information in SendError. This helps in providing more detailed error reporting and troubleshooting.
This commit is contained in:
parent
f367db0278
commit
719e5b217c
1 changed files with 6 additions and 1 deletions
|
@ -27,8 +27,13 @@ import "errors"
|
||||||
// - An error that represents the sending result, which may include multiple SendErrors if
|
// - An error that represents the sending result, which may include multiple SendErrors if
|
||||||
// any occurred; otherwise, returns nil.
|
// any occurred; otherwise, returns nil.
|
||||||
func (c *Client) Send(messages ...*Msg) error {
|
func (c *Client) Send(messages ...*Msg) error {
|
||||||
|
escSupport := false
|
||||||
|
if c.smtpClient != nil {
|
||||||
|
escSupport, _ = c.smtpClient.Extension("ENHANCEDSTATUSCODES")
|
||||||
|
}
|
||||||
if err := c.checkConn(); err != nil {
|
if err := c.checkConn(); err != nil {
|
||||||
return &SendError{Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err)}
|
return &SendError{Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err),
|
||||||
|
errcode: errorCode(err), enhancedStatusCode: enhancedStatusCode(err, escSupport)}
|
||||||
}
|
}
|
||||||
var errs []*SendError
|
var errs []*SendError
|
||||||
for id, message := range messages {
|
for id, message := range messages {
|
||||||
|
|
Loading…
Reference in a new issue