Add SMTP_HELLO_NAME to let operators set the EHLO/HELO identity

Google Workspace SMTP relay (smtp-relay.gmail.com) rejects generic
EHLO identifiers such as "localhost", which is Go net/smtp's default.
Operators can now set SMTP_HELLO_NAME to a valid hostname so that
c.Hello() is called before StartTLS, satisfying strict relay policies.

Fixes https://github.com/getprobo/probo/issues/1284

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-06-05 07:22:55 +02:00
parent 8231aecaba
commit 552246b5d3
8 changed files with 20 additions and 0 deletions

View File

@@ -225,6 +225,10 @@ spec:
{{- end }}
- name: SMTP_TLS_REQUIRED
value: {{ .Values.probo.mailer.smtp.tlsRequired | quote }}
{{- if .Values.probo.mailer.smtp.helloName }}
- name: SMTP_HELLO_NAME
value: {{ .Values.probo.mailer.smtp.helloName | quote }}
{{- end }}
# OpenAI Integration
{{- if .Values.probo.openai.apiKey }}
- name: OPENAI_API_KEY

View File

@@ -157,6 +157,9 @@ probo:
user: "apikey"
password: "CHANGE_ME_SMTP_PASSWORD"
tlsRequired: true
# Set to your server's hostname when the relay requires a specific EHLO/HELO
# identity (e.g. Google Workspace smtp-relay.gmail.com rejects "localhost").
# helloName: "mail.example.com"
# OpenAI integration for AI features (optional)
openai:

View File

@@ -251,11 +251,13 @@ probo:
user: ""
password: ""
tlsRequired: true
helloName: ""
# smtp:
# addr: "localhost:1025"
# user: ""
# password: ""
# tlsRequired: false
# helloName: ""
# OpenAI integration (optional)
openai:

View File

@@ -166,6 +166,7 @@ func (b *Builder) Build() (*probodconfig.FullConfig, error) {
User: b.getEnv("SMTP_USER"),
Password: b.getEnv("SMTP_PASSWORD"),
TLSRequired: b.getEnvBoolOrDefault("SMTP_TLS_REQUIRED", false),
HelloName: b.getEnv("SMTP_HELLO_NAME"),
},
},
Slack: probodconfig.SlackConfig{

View File

@@ -192,6 +192,7 @@ func TestBuilder_Build_Defaults(t *testing.T) {
assert.Equal(t, "no-reply@notification.getprobo.com", cfg.Probod.Notifications.Mailer.SenderEmail)
assert.Equal(t, "localhost:1025", cfg.Probod.Notifications.Mailer.SMTP.Addr)
assert.False(t, cfg.Probod.Notifications.Mailer.SMTP.TLSRequired)
assert.Empty(t, cfg.Probod.Notifications.Mailer.SMTP.HelloName)
assert.Equal(t, 60, cfg.Probod.Notifications.Mailer.MailerInterval)
assert.Equal(t, 60, cfg.Probod.Notifications.Slack.SenderInterval)
assert.Empty(t, cfg.Probod.Notifications.Slack.SigningSecret)

View File

@@ -49,6 +49,7 @@ type (
User string
Password string
TLSRequired bool
HelloName string
}
SendingWorkerOption func(*sendingHandler)
@@ -319,6 +320,12 @@ func (h *sendingHandler) sendMail(ctx context.Context, to []string, msg []byte)
defer func() { _ = c.Quit() }()
if h.smtp.HelloName != "" {
if err := c.Hello(h.smtp.HelloName); err != nil {
return fmt.Errorf("SMTP EHLO error: %w", err)
}
}
if h.smtp.TLSRequired {
if err := c.StartTLS(&tls.Config{ServerName: host}); err != nil {
return fmt.Errorf("TLS negotiation error: %w", err)

View File

@@ -654,6 +654,7 @@ func (impl *Implm) Run(
User: impl.cfg.Notifications.Mailer.SMTP.User,
Password: impl.cfg.Notifications.Mailer.SMTP.Password,
TLSRequired: impl.cfg.Notifications.Mailer.SMTP.TLSRequired,
HelloName: impl.cfg.Notifications.Mailer.SMTP.HelloName,
},
l.Named("sending-worker"),
[]mailer.SendingWorkerOption{

View File

@@ -26,4 +26,5 @@ type SMTPConfig struct {
User string `json:"user"`
Password string `json:"password"`
TLSRequired bool `json:"tls-required"`
HelloName string `json:"hello-name"`
}