RocketChat/Rocket.Chat · error · Meteor.Error
error-email-send-failed
error-email-send-failed
Error message
Error trying to send email: ${message} What it means
Thrown by listenSessionLogin (deviceManagement/session.ts) when Mailer.send rejects while sending the device-management session-login notification email. The original error is caught by destructuring { message } and re-thrown as a Meteor.Error code 'error-email-send-failed' wrapping the underlying message. The original cause lives in the error.details.message field.
Source
Thrown at apps/meteor/ee/server/lib/deviceManagement/session.ts:113
mailData.browserInfo = `Rocket.Chat ${app?.name || browser.name} ${app?.bundle || app?.version || browser.version}`;
mailData.osInfo = `${os.name}`;
mailData.deviceInfo = `Desktop App ${cpu.architecture || ''}`;
break;
default:
mailData.userAgent = userAgent || '';
break;
}
try {
await Mailer.send({
to: `${name} <${email}>`,
from: Accounts.emailTemplates.from,
subject: settings.get('Device_Management_Email_Subject'),
html: mailTemplates,
data: mailData,
});
} catch ({ message }: any) {
throw new Meteor.Error('error-email-send-failed', `Error trying to send email: ${message}`, {
method: 'listenSessionLogin',
message,
});
}
});
};
View on GitHub (pinned to f9d3ec372b)
Solutions
- Read error.details.message for the SMTP/transport cause and fix the specific failure (credentials, host, port, TLS).
- Verify Accounts.emailTemplates.from and the SMTP settings are valid and that the relay accepts the From address.
- Confirm the target user has a valid email and that Device_Management_Email_Subject is set.
- Retry the login/notification once the transport is healthy — the underlying login itself is not affected.
Example fix
// before
} catch ({ message }: any) {
throw new Meteor.Error('error-email-send-failed', `Error trying to send email: ${message}`);
}
// caller-side: don't let a notification failure break login
try { await sendSessionLoginMail(...); }
catch (e) { logger.error({ msg: 'session email failed', cause: e.details?.message }); } Defensive patterns
Strategy: try-catch
Validate before calling
async function smtpReachable(): Promise<boolean> {
// ping the configured SMTP host/port before relying on Mailer
return new Promise((resolve) => {
const socket = net.connect(Number(smtpPort), smtpHost);
socket.setTimeout(2000).on('connect', () => { socket.end(); resolve(true); }).on('error', () => resolve(false)).on('timeout', () => { socket.destroy(); resolve(false); });
});
} Type guard
null
Try / catch
try { await sendSessionLoginMail(...); } catch (e) {
if (e instanceof Meteor.Error && e.error === 'error-email-send-failed') {
logger.error({ msg: 'session email failed', cause: e.details?.message }); // don't break login
} else throw e;
} Prevention
- Validate SMTP settings and From address on save.
- Keep device-management notification non-blocking so login UX is unaffected.
- Surface error.details.message in admin alerts for actionable SMTP diagnostics.
When it happens
Trigger: A session-login event fires (new device/browser login) and Mailer.send fails: SMTP host unreachable, auth rejected, invalid recipient address, From address misconfigured, or the email template / Device_Management_Email_Subject setting is empty.
Common situations: SMTP credentials rotated but not updated; From address rejected by relay; user's email field invalid; email gateway down or rate-limiting; missing Mailer configuration on a fresh install.
Related errors
- error-email-send-failed
- error-action-not-allowed
- error-action-not-allowed
- error-action-not-allowed
- Trigger is not configured to use an external service
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/749e93d26d7f628f.
Report an issue: GitHub.