{"record":{"id":"4b63fde2a4ec5c5d","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-from-address","errorCode":"error-invalid-from-address","errorMessage":"Invalid from address","messagePattern":"Invalid from address","errorType":"error_code","errorClass":"Meteor.Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/server/lib/notifications/email/api.ts","lineNumber":217,"sourceCode":"}): Promise<void> =>\n\tsendNoWrap({\n\t\tto,\n\t\tfrom,\n\t\treplyTo,\n\t\tsubject: replace(subject, data),\n\t\ttext: (text && replace(text, data)) || (html && stripHtml(replace(html, data)).result) || undefined,\n\t\thtml: html ? wrap(html, data) : undefined,\n\t\theaders,\n\t});\n\n// Needed because of https://github.com/microsoft/TypeScript/issues/36931\ntype Assert = (input: string, func: string) => asserts input;\nexport const checkAddressFormatAndThrow: Assert = (from: string, func: string): asserts from => {\n\tif (checkAddressFormat(from)) {\n\t\treturn;\n\t}\n\n\tthrow new Meteor.Error('error-invalid-from-address', 'Invalid from address', {\n\t\tfunction: func,\n\t});\n};\n\nexport const getHeader = (): string | undefined => contentHeader;\n\nexport const getFooter = (): string | undefined => contentFooter;\n","sourceCodeStart":199,"sourceCodeEnd":225,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/notifications/email/api.ts#L199-L225","documentation":"checkAddressFormatAndThrow asserts that a 'from' address passes the same @rocket.chat/tools format check, and throws Meteor.Error('error-invalid-from-address', 'Invalid from address') with the offending function name in the error details. It is the guard Mailer.sendMail (and other mail paths) run on the sender address before doing any work.","triggerScenarios":"Mailer.send / sendNoWrap / sendMail invoked with from = 'no-reply' (no domain), an empty string, or a display name without an angle-addr; the SMTP From_Address setting holds an invalid address that flows into these calls.","commonSituations":"Administration -> Email -> SMTP 'From Address' misconfigured after setup; code reading Meteor.settings.fromEmail that is unset in that environment; setting renamed or reset across version upgrades.","solutions":["Read the 'function' field in the error details to identify which caller passed the bad address","Set Administration -> Email -> From Address to a valid RFC address (name@domain.tld)","In code, default 'from' to the configured setting and run checkAddressFormat before sending"],"exampleFix":"// before\nconst from = Meteor.settings.fromEmail ?? '';\nawait Mailer.sendMail({ from, subject, body });\n\n// after\nconst from = Meteor.settings.fromEmail ?? Settings.get('From_Address');\nMailer.checkAddressFormatAndThrow(from, 'myMailer');\nawait Mailer.sendMail({ from, subject, body });","handlingStrategy":"validation","validationCode":"Mailer.checkAddressFormatAndThrow(from, 'myMailerCall');\n// reaching here means 'from' is safe; now call send/sendMail","typeGuard":null,"tryCatchPattern":"try {\n  await Mailer.sendMail({ from, subject, body });\n} catch (err) {\n  if (err instanceof Meteor.Error && err.error === 'error-invalid-from-address') {\n    // err.details.function names the caller; fix the from setting/value\n  } else throw err;\n}","preventionTips":["Keep Administration -> Email -> From Address set to a valid name@domain.tld","Never pass an unchecked env/setting value as 'from'","Prefer re-using the configured From_Address setting as the default sender"],"tags":["email","smtp","configuration","from-address","rocket-chat"],"backgroundTag":"invalid-email-address","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}