RocketChat.Migrations.add({
	version: 95,
	up() {
		if (RocketChat && RocketChat.models && RocketChat.models.Settings) {
			const emailHeader = RocketChat.models.Settings.findOne({ _id: 'Email_Header' });
			const emailFooter = RocketChat.models.Settings.findOne({ _id: 'Email_Footer' });
			const startWithHTML = emailHeader.value.match(/^<html>/);
			const endsWithHTML = emailFooter.value.match(/<\/hmtl>$/);

			if (!startWithHTML) {
				RocketChat.models.Settings.update(
					{ _id: 'Email_Header' },
					{ $set: { value: `<html>${ emailHeader.value }`} }
				);
			}

			if (!endsWithHTML) {
				RocketChat.models.Settings.update(
					{ _id: 'Email_Footer' },
					{ $set: { value: `${ emailFooter.value }</hmtl>`} }
				);
			}
		}
	}
});

Add <html> tags to email header and footer
Add <html> tags to email header and footer
