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.SMTPPassword

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Read result.Message in the returned error — it names the actual cause; fix that underlying issue.
  2. Verify SMTPServer resolves and the SMTPPort is reachable from the server (nc/telnet host port).
  3. Re-check SMTPUser/SMTPPassword against the mail provider.
  4. 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

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


AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05). Data as JSON: /api/errors/61450fdd2d0da4a1. Report an issue: GitHub.