Billionmail/BillionMail · error

Email Sender not configured

Error message

Email Sender not configured

What it means

NewEmailSenderWithLocal builds an EmailSender from local mailbox config, then requires es.IsConfigured() (host/port/credentials present). If the underlying settings query succeeds but yields no usable SMTP configuration, it returns 'Email Sender not configured'.

Source

Thrown at core/internal/service/mail_service/sending.go:146

		// e.SNI, _ = public.DockerEnv("BILLIONMAIL_HOSTNAME")
	}

	return e
}

func NewEmailSenderWithLocal(email string) (es *EmailSender, err error) {
	es = NewEmailSender()

	es.Email = email
	es.UserName = email
	es.Password, err = PasswordPlainByEmail(context.Background(), email)

	if err != nil {
		return
	}

	if !es.IsConfigured() {
		err = errors.New("Email Sender not configured")
		return
	}

	return
}

// PasswordPlainByEmail
func PasswordPlainByEmail(ctx context.Context, email string) (string, error) {
	val, err := g.DB().Model("mailbox").Where("username", email).Value("password_encode")
	if err != nil {
		return "", fmt.Errorf("query password failed: %w", err)
	}
	if val.IsEmpty() {
		return "", fmt.Errorf("password not found for %s", email)
	}
	rawHex, err := hex.DecodeString(val.String())
	if err != nil {
		return "", fmt.Errorf("hex decode failed: %w", err)

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Configure the Email Sender (SMTP host, port, username, password) in the admin settings UI.
  2. Verify the settings table actually contains the sender keys with non-empty values.
  3. Guard call sites: check IsConfigured() before invoking send paths to fail gracefully.
  4. If sending is not intended on this instance, skip the send call instead of treating this as a runtime fault.

Example fix

// before
err := SendMail(ctx, msg)
// after
if !mail_service.IsEmailSenderConfigured(ctx) {
    return errors.New("please configure the Email Sender in settings before sending")
}
err := SendMail(ctx, msg)
Defensive patterns

Strategy: validation

Validate before calling

es := mail_service.NewEmailSender()
if es == nil || !es.IsConfigured() {
    return errors.New("Email Sender is not configured: set SMTP host/port/credentials in settings first")
}

Try / catch

if err := SendTestEmail(ctx); err != nil {
    if strings.Contains(err.Error(), "Email Sender not configured") {
        return fmt.Errorf("cannot send: complete SMTP setup in admin settings (%w)", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling SendMail, SendTestEmail, ApiMailBatchSend, sendConfirmationEmail, or recordApiMailLog when no email sender (SMTP host/user/password) has been set up in the system settings.

Common situations: Fresh BillionMail install where the admin never configured the mail sender; settings row deleted or keys emptied; environment where outbound SMTP was intentionally disabled.

Related errors


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