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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user