mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-14 18:02:55 +01:00
Refactor TLS policy comments for clarity
Updated comments for WithTLSPolicy and WithTLSPortPolicy to provide clearer explanations. Improved readability and emphasized recommended best practices for SMTP TLS connections.
This commit is contained in:
parent
3e5c93a418
commit
bae0ac6cde
1 changed files with 11 additions and 11 deletions
22
client.go
22
client.go
|
@ -348,10 +348,10 @@ func WithHELO(helo string) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// WithTLSPolicy tells the client to use the provided TLSPolicy
|
||||
// WithTLSPolicy sets the TLSPolicy of the Client and overrides the DefaultTLSPolicy
|
||||
//
|
||||
// Note: To follow best-practices for SMTP TLS connections, it is recommended
|
||||
// to use WithTLSPortPolicy instead.
|
||||
// Note: To follow best-practices for SMTP TLS connections, it is recommended to use
|
||||
// WithTLSPortPolicy instead.
|
||||
func WithTLSPolicy(policy TLSPolicy) Option {
|
||||
return func(c *Client) error {
|
||||
c.tlspolicy = policy
|
||||
|
@ -359,16 +359,16 @@ func WithTLSPolicy(policy TLSPolicy) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// WithTLSPortPolicy tells the client to use the provided TLSPolicy,
|
||||
// The correct port is automatically set.
|
||||
// WithTLSPortPolicy enables explicit TLS via STARTTLS for the Client using the provided TLSPolicy. The
|
||||
// correct port is automatically set.
|
||||
//
|
||||
// Port 587 is used for TLSMandatory and TLSOpportunistic.
|
||||
// If the connection fails with TLSOpportunistic,
|
||||
// a plaintext connection is attempted on port 25 as a fallback.
|
||||
// NoTLS will allways use port 25.
|
||||
// If TLSMandatory or TLSOpportunistic are provided as TLSPolicy, port 587 will be used for the connection.
|
||||
// If the connection fails with TLSOpportunistic, the Client will attempt to connect on port 25 using
|
||||
// using an unencrypted connection as a fallback. If NoTLS is provided, the Client will always use port 25.
|
||||
//
|
||||
// Note: If a different port has already been set otherwise, the port-choosing
|
||||
// and fallback automatism will be skipped.
|
||||
// Note: If a different port has already been set otherwise using WithPort, the selected port has higher
|
||||
// precedence and is used to establish the SSL/TLS connection. In this case the authmatic fallback
|
||||
// mechanism is skipped at all.
|
||||
func WithTLSPortPolicy(policy TLSPolicy) Option {
|
||||
return func(c *Client) error {
|
||||
c.SetTLSPortPolicy(policy)
|
||||
|
|
Loading…
Reference in a new issue