RocketChat/Rocket.Chat · error · Meteor.Error

error-email-send-failed

error-email-send-failed

Error message

Error trying to send email: ${error instanceof Error ? error.message : String(error)}

What it means

Meteor.Error('error-email-send-failed') wrapping the underlying error from Mailer.send while delivering the 'E2E_key_reset_email' notification. The original transport message is preserved in both the error reason and details ({ function: 'resetUserE2EEncriptionKey', message }).

Source

Thrown at apps/meteor/server/lib/resetUserE2EKey.ts:47

	const html = `
		<p>${t('Your_e2e_key_has_been_reset')}</p>
		<p>${t('E2E_Reset_Email_Content')}</p>
	`;

	const from = settings.get('From_Email');
	const subject = t('E2E_key_reset_email');

	for await (const address of addresses) {
		try {
			await Mailer.send({
				to: address,
				from,
				subject,
				text,
				html,
			} as any);
		} catch (error) {
			throw new Meteor.Error(
				'error-email-send-failed',
				`Error trying to send email: ${error instanceof Error ? error.message : String(error)}`,
				{
					function: 'resetUserE2EEncriptionKey',
					message: error instanceof Error ? error.message : String(error),
				},
			);
		}
	}
};

export async function resetUserE2EEncriptionKey(uid: string, notifyUser: boolean): Promise<boolean> {
	if (notifyUser) {
		await sendResetNotification(uid);
	}

	const isUserFederated = await isUserIdFederated(uid);
	if (isUserFederated) {

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Open Administration > Email and use the test-email action to reproduce the SMTP failure directly.
  2. Fix host/port/username/password/TLS per your provider and retry the reset.
  3. Read the wrapped message in error.details.message for the exact SMTP cause.
  4. If email notification is not required for your flow, call the reset with notifyUser=false.

Example fix

// before
await resetUserE2EEncriptionKey(uid, true); // SMTP problems abort the whole reset

// after: decouple the reset from email delivery
await resetUserE2EEncriptionKey(uid, false);
// send the notification separately with its own retry logic
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await resetUserE2EEncriptionKey(uid, true);
} catch (error: any) {
  if (error?.error === 'error-email-send-failed') {
    // error.details.message holds the SMTP cause; fix mail settings and retry
  }
}

Prevention

When it happens

Trigger: resetUserE2EEncriptionKey(uid, true) when the SMTP send fails: unreachable host, wrong port, rejected credentials, or TLS errors while sending to one of the user's verified addresses.

Common situations: Development environments without SMTP; rotated/expired SMTP credentials; mail provider throttling or quota; firewall/DNS blocking outbound SMTP.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/f9fea2f799ba8ac8. Report an issue: GitHub.