diff --git a/courier/smtp.go b/courier/smtp.go index 2c49e1c2edbf..7b0f0834a8ff 100644 --- a/courier/smtp.go +++ b/courier/smtp.go @@ -43,14 +43,16 @@ func newSMTP(ctx context.Context, deps Dependencies) *smtpClient { } } + localName := deps.CourierConfig(ctx).CourierSMTPLocalName() password, _ := uri.User.Password() port, _ := strconv.ParseInt(uri.Port(), 10, 0) dialer := &gomail.Dialer{ - Host: uri.Hostname(), - Port: int(port), - Username: uri.User.Username(), - Password: password, + Host: uri.Hostname(), + Port: int(port), + Username: uri.User.Username(), + Password: password, + LocalName: localName, Timeout: time.Second * 10, RetryFailure: true, diff --git a/driver/config/config.go b/driver/config/config.go index 538e991bd5c7..a795f5d71bf3 100644 --- a/driver/config/config.go +++ b/driver/config/config.go @@ -70,6 +70,7 @@ const ( ViperKeyCourierSMTPFrom = "courier.smtp.from_address" ViperKeyCourierSMTPFromName = "courier.smtp.from_name" ViperKeyCourierSMTPHeaders = "courier.smtp.headers" + ViperKeyCourierSMTPLocalName = "courier.smtp.local_name" ViperKeyCourierSMSRequestConfig = "courier.sms.request_config" ViperKeyCourierSMSEnabled = "courier.sms.enabled" ViperKeyCourierSMSFrom = "courier.sms.from" @@ -245,6 +246,7 @@ type ( CourierSMTPFrom() string CourierSMTPFromName() string CourierSMTPHeaders() map[string]string + CourierSMTPLocalName() string CourierSMSEnabled() bool CourierSMSFrom() string CourierSMSRequestConfig() json.RawMessage @@ -879,6 +881,10 @@ func (p *Config) CourierSMTPFromName() string { return p.p.StringF(ViperKeyCourierSMTPFromName, "") } +func (p *Config) CourierSMTPLocalName() string { + return p.p.StringF(ViperKeyCourierSMTPLocalName, "localhost") +} + func (p *Config) CourierTemplatesRoot() string { return p.p.StringF(ViperKeyCourierTemplatesPath, "courier/builtin/templates") } diff --git a/embedx/config.schema.json b/embedx/config.schema.json index 9e72a15135a9..bc10ad755b69 100644 --- a/embedx/config.schema.json +++ b/embedx/config.schema.json @@ -1539,6 +1539,12 @@ "X-SES-RETURN-PATH-ARN": "arn:aws:ses:us-west-2:123456789012:identity/example.com" } ] + }, + "local_name": { + "title": "SMTP HELO/EHLO name", + "description": "Identifier used in the SMTP HELO/EHLO command. Some SMTP relays require a unique identifier.", + "type": "string", + "default": "localhost" } }, "required": [