mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-14 09:52:54 +01:00
Refactor Send method documentation in client files
Updated the documentation for the Send method in client_119.go and client_120.go to provide clearer explanations, include detailed descriptions of parameters, and specify return values. Ensured consistency across files by elaborating on error handling and connection checks.
This commit is contained in:
parent
756269644e
commit
3e8706d52e
2 changed files with 30 additions and 6 deletions
|
@ -10,9 +10,22 @@ package mail
|
|||
import "errors"
|
||||
|
||||
// Send attempts to send one or more Msg using the Client connection to the SMTP server.
|
||||
// If the Client has no active connection to the server, Send will fail with an error. For each of the
|
||||
// provided Msg it will associate a SendError to the Msg in case there of a transmission or delivery
|
||||
// error.
|
||||
// If the Client has no active connection to the server, Send will fail with an error. For each
|
||||
// of the provided Msg, it will associate a SendError with the Msg in case of a transmission
|
||||
// or delivery error.
|
||||
//
|
||||
// This method first checks for an active connection to the SMTP server. If the connection is
|
||||
// not valid, it returns a SendError. It then iterates over the provided messages, attempting
|
||||
// to send each one. If an error occurs during sending, the method records the error and
|
||||
// associates it with the corresponding Msg. If multiple errors are encountered, it aggregates
|
||||
// them into a single SendError to be returned.
|
||||
//
|
||||
// Parameters:
|
||||
// - messages: A variadic list of pointers to Msg objects to be sent.
|
||||
//
|
||||
// Returns:
|
||||
// - An error that represents the sending result, which may include multiple SendErrors if
|
||||
// any occurred; otherwise, returns nil.
|
||||
func (c *Client) Send(messages ...*Msg) error {
|
||||
if err := c.checkConn(); err != nil {
|
||||
return &SendError{Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err)}
|
||||
|
|
|
@ -12,9 +12,20 @@ import (
|
|||
)
|
||||
|
||||
// Send attempts to send one or more Msg using the Client connection to the SMTP server.
|
||||
// If the Client has no active connection to the server, Send will fail with an error. For each of the
|
||||
// provided Msg it will associate a SendError to the Msg in case there of a transmission or delivery
|
||||
// error.
|
||||
// If the Client has no active connection to the server, Send will fail with an error. For each
|
||||
// of the provided Msg, it will associate a SendError with the Msg in case of a transmission
|
||||
// or delivery error.
|
||||
//
|
||||
// This method first checks for an active connection to the SMTP server. If the connection is
|
||||
// not valid, it returns an error wrapped in a SendError. It then iterates over the provided
|
||||
// messages, attempting to send each one. If an error occurs during sending, the method records
|
||||
// the error and associates it with the corresponding Msg.
|
||||
//
|
||||
// Parameters:
|
||||
// - messages: A variadic list of pointers to Msg objects to be sent.
|
||||
//
|
||||
// Returns:
|
||||
// - An error that aggregates any SendErrors encountered during the sending process; otherwise, returns nil.
|
||||
func (c *Client) Send(messages ...*Msg) (returnErr error) {
|
||||
if err := c.checkConn(); err != nil {
|
||||
returnErr = &SendError{Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err)}
|
||||
|
|
Loading…
Reference in a new issue