mirror of
https://github.com/harness-community/drone-email.git
synced 2026-06-04 18:24:18 +08:00
Merge pull request #6 from harness-community/CI-20805
fix[CI-20805]: use WithTLSPolicy instead of WithTLSPortPolicy to preserve user-configured SMTP port
This commit is contained in:
@@ -185,10 +185,13 @@ func (p Plugin) Exec() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle STARTTLS policy
|
// Handle STARTTLS policy
|
||||||
|
// Note: Use WithTLSPolicy (not WithTLSPortPolicy) to avoid overriding
|
||||||
|
// the user-configured port. WithTLSPortPolicy treats port 25 as "default/unset"
|
||||||
|
// and silently changes it to 587 for TLSOpportunistic/TLSMandatory.
|
||||||
if p.Config.NoStartTLS {
|
if p.Config.NoStartTLS {
|
||||||
options = append(options, mail.WithTLSPortPolicy(mail.NoTLS))
|
options = append(options, mail.WithTLSPolicy(mail.NoTLS))
|
||||||
} else {
|
} else {
|
||||||
options = append(options, mail.WithTLSPortPolicy(mail.TLSOpportunistic))
|
options = append(options, mail.WithTLSPolicy(mail.TLSOpportunistic))
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := mail.NewClient(p.Config.Host, options...)
|
client, err := mail.NewClient(p.Config.Host, options...)
|
||||||
|
|||||||
Reference in New Issue
Block a user