Billionmail/BillionMail · error
%s
Error message
%s
What it means
testSMTPConnectionWithRelay runs an external SMTP connection test; when result.Success is false the tool's own message is rewrapped verbatim (fmt.Errorf("%s", result.Message)) and returned to the caller. The text after this prefix is whatever the connection test reported (auth failure, DNS failure, timeout, etc.).
Source
Thrown at core/internal/controller/settings/settings_v1_set_blacklist_alert_settings.go:111
return fmt.Errorf("invalid recipient email format: %s", recipient)
}
}
return nil
}
func testSMTPConnectionWithRelay(ctx context.Context, settings *v1.SetBlacklistAlertSettingsReq) error {
//g.Log().Infof(ctx, "Testing SMTP connection to %s:%d", settings.SMTPServer, settings.SMTPPort)
result := relay.TestSmtpConnection(
settings.SMTPServer,
fmt.Sprintf("%d", settings.SMTPPort),
settings.SenderEmail,
settings.SMTPPassword,
)
if !result.Success {
return fmt.Errorf("%s", result.Message)
}
//g.Log().Infof(ctx, "SMTP connection test successful: %s", result.Message)
return nil
}
func sendTestEmailWithMailService(ctx context.Context, settings *v1.SetBlacklistAlertSettingsReq) error {
//g.Log().Infof(ctx, "Sending test email to %v", settings.RecipientList)
subject := "Blacklist Alert Test - BillionMail"
body := buildTestEmailHTML(settings)
sender := mail_service.NewEmailSender()
sender.Host = settings.SMTPServer
sender.Port = fmt.Sprintf("%d", settings.SMTPPort)
sender.Email = settings.SenderEmail
sender.UserName = settings.SenderEmail
sender.Password = settings.SMTPPasswordView on GitHub (pinned to fc36c76c05)
Solutions
- Read result.Message in the returned error — it names the actual cause; fix that underlying issue.
- Verify SMTPServer resolves and the SMTPPort is reachable from the server (nc/telnet host port).
- Re-check SMTPUser/SMTPPassword against the mail provider.
- Fall back to sendTestEmailWithMailService (internal mail service) if the external relay path is not required.
Example fix
// before
if !result.Success { return fmt.Errorf("%s", result.Message) }
// after
if !result.Success {
return fmt.Errorf("SMTP connection test failed: %s", result.Message) // add context
} Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check reachability before saving settings
const up = await fetch(`/api/diag/tcp?host=${host}&port=${port}`).then(r => r.ok)
if (!up) throw new Error('SMTP host unreachable; fix host/port before saving') Try / catch
err := SetBlacklistAlertSettings(ctx, req)
if err != nil {
// err text is the raw relay/test-tool message; log it verbatim for diagnosis
log.Printf("blacklist alert SMTP test failed: %v", err)
return echoNewError(err.Error())
} Prevention
- Read result.Message — it contains the true underlying cause
- Pre-test connectivity (DNS + TCP) from the server before persisting settings
- Keep fallback to the internal mail-service path when the relay probe fails
When it happens
Trigger: SetBlacklistAlertSettings with testMode triggering testSMTPConnectionWithRelay where the relay probe fails — wrong host/port, bad credentials, unreachable server, or TLS negotiation failure.
Common situations: SMTP server hostname has a typo; firewall blocks outbound port 587/465; credentials rotated; the relay binary is missing or fails to start so result.Message carries its error output.
Related errors
- failed to connect to SMTP server: %v
- failed to connect to SMTP server: %v
- TLS dial: %w
- SMTP dial: %w
- base URL not configured
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/61450fdd2d0da4a1.
Report an issue: GitHub.