Support HELO

This commit is contained in:
Nicolai Langfeldt
2025-04-24 11:17:35 +02:00
parent 3945356888
commit 846e3b9a37
2 changed files with 14 additions and 0 deletions

View File

@ -92,12 +92,25 @@ func sendMail(e *mail.Envelope, config *relayConfig) error {
}
func handshake(client *smtp.Client, config *relayConfig, tlsConfig *tls.Config) error {
if config.HeloHost != "" {
if err := client.Hello(config.HeloHost); err != nil {
return errors.Wrap(err, "HELO error")
}
}
if config.STARTTLS {
if err := client.StartTLS(tlsConfig); err != nil {
return errors.Wrap(err, "starttls error")
}
// Re-HELO after STARTTLS
if config.HeloHost != "" {
if err := client.Hello(config.HeloHost); err != nil {
return errors.Wrap(err, "HELO error")
}
}
}
var auth smtp.Auth
if config.LoginAuthType {
auth = LoginAuth(config.Username, config.Password)

View File

@ -64,6 +64,7 @@ type relayConfig struct {
Username string `json:"smtp_username"`
Password string `json:"smtp_password"`
SkipVerify bool `json:"smtp_skip_cert_verify"`
HeloHost string `json:"smtp_helo"`
}
// mailRelayProcessor decorator relays emails to another SMTP server.