{"record":{"id":"62da76e9c748e203","repo":"Billionmail/BillionMail","slug":"invalid-sender-email-format","errorCode":null,"errorMessage":"invalid sender email format","messagePattern":"invalid sender email format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/controller/settings/settings_v1_set_blacklist_alert_settings.go","lineNumber":72,"sourceCode":"\t}\n\n\terr = gfile.PutContents(alertSettingsFile, string(jsonData))\n\tif err != nil {\n\t\tres.SetError(gerror.Newf(public.LangCtx(ctx, \"Failed to save alert settings: {}\", err.Error())))\n\t\treturn res, nil\n\t}\n\n\tres.SetSuccess(public.LangCtx(ctx, \"Alert settings saved successfully and test email sent\"))\n\treturn res, nil\n}\n\nfunc validateAlertSettings(settings *v1.SetBlacklistAlertSettingsReq) error {\n\tif settings.SenderEmail == \"\" {\n\t\treturn fmt.Errorf(\"sender email is required\")\n\t}\n\n\tif !strings.Contains(settings.SenderEmail, \"@\") {\n\t\treturn fmt.Errorf(\"invalid sender email format\")\n\t}\n\n\tif settings.SMTPServer == \"\" {\n\t\treturn fmt.Errorf(\"SMTP server is required\")\n\t}\n\n\tif settings.SMTPPort < 1 || settings.SMTPPort > 65535 {\n\t\treturn fmt.Errorf(\"SMTP port must be between 1 and 65535\")\n\t}\n\n\tif settings.SMTPPassword == \"\" {\n\t\treturn fmt.Errorf(\"SMTP password is required\")\n\t}\n\n\tif len(settings.RecipientList) == 0 {\n\t\treturn fmt.Errorf(\"at least one recipient is required\")\n\t}\n","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/controller/settings/settings_v1_set_blacklist_alert_settings.go#L54-L90","documentation":"validateAlertSettings performs a lightweight format check on SenderEmail — it must contain an '@' character. This is not a full RFC 5322 validation, but any value without '@' (or with only whitespace around it) is rejected before the alert settings are saved.","triggerScenarios":"SenderEmail set to a bare username ('alerts'), a display name ('Alert Bot'), a value with spaces but no @, or an address missing the domain part ('alerts@').","commonSituations":"Users paste 'Name <alerts@example.com>' style headers, or enter just the local part assuming the domain is appended automatically.","solutions":["Provide a full address including domain, e.g. alerts@example.com","Strip display-name formatting and send only the bare address","Add stricter client-side validation (regex or HTML5 type=email) before submit","Note the server check is only a Contains(\"@\") — validate thoroughly on the client"],"exampleFix":"// before\n{ \"senderEmail\": \"Alert Bot <alerts@example.com>\" }\n// after\n{ \"senderEmail\": \"alerts@example.com\" }","handlingStrategy":"validation","validationCode":"const sender = (settings.senderEmail ?? '').trim();\nif (!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(sender)) throw new Error('invalid sender email format');","typeGuard":"function isEmailLike(v: unknown): v is string {\n  return typeof v === 'string' && /^[^@\\s]+@[^@\\s]+$/.test(v);\n}","tryCatchPattern":"try {\n  await api.setBlacklistAlertSettings(settings);\n} catch (e) {\n  if (String(e.message).includes('invalid sender email format')) {\n    notify('Enter a full email address, e.g. alerts@example.com');\n  } else throw e;\n}","preventionTips":["Send only the bare address, no display-name brackets","Use type=email inputs or a strict email regex client-side","Ensure the domain part is present after the @","Strip name prefixes like 'Name <addr>' before submitting"],"tags":["validation","email","format"],"backgroundTag":"invalid-email-format","analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}