Fix: email encoding bug (#7490)
* fix: existing decode Uri * feat: unescape characters in base email * fix: encoding in booking page
This commit is contained in:
1 parent
2d26d73eb3
commit
26ea249481
4 files changed
+16
-7
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import nodemailer from "nodemailer";
|
||||
import { z } from "zod";
|
||||
|
||||
import type { Dayjs } from "@calcom/dayjs";
|
||||
import dayjs from "@calcom/dayjs";
|
||||
@@ -34,10 +35,18 @@ export default class BaseEmail {
|
||||
console.log("Skipped Sending Email as NEXT_PUBLIC_IS_E2E==1");
|
||||
return new Promise((r) => r("Skipped sendEmail for E2E"));
|
||||
}
|
||||
|
||||
const payload = this.getNodeMailerPayload();
|
||||
const parseSubject = z.string().safeParse(payload?.subject);
|
||||
const payloadWithUnEscapedSubject = {
|
||||
...payload,
|
||||
...(parseSubject.success && { subject: decodeURIComponent(parseSubject.data) }),
|
||||
};
|
||||
|
||||
new Promise((resolve, reject) =>
|
||||
nodemailer
|
||||
.createTransport(this.getMailerOptions().transport)
|
||||
.sendMail(this.getNodeMailerPayload(), (_err, info) => {
|
||||
.sendMail(payloadWithUnEscapedSubject, (_err, info) => {
|
||||
if (_err) {
|
||||
const err = getErrorFromUnknown(_err);
|
||||
this.printNodeMailerError(err);
|
||||
|
||||
@@ -78,7 +78,7 @@ export default class AttendeeScheduledEmail extends BaseEmail {
|
||||
to: `${this.attendee.name} <${this.attendee.email}>`,
|
||||
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
|
||||
replyTo: [...this.calEvent.attendees.map(({ email }) => email), this.calEvent.organizer.email],
|
||||
subject: decodeURIComponent(`${this.calEvent.title}`),
|
||||
subject: `${this.calEvent.title}`,
|
||||
html: renderEmail("AttendeeScheduledEmail", {
|
||||
calEvent: this.calEvent,
|
||||
attendee: this.attendee,
|
||||
|
||||
@@ -76,9 +76,7 @@ export default class OrganizerScheduledEmail extends BaseEmail {
|
||||
},
|
||||
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
|
||||
to: toAddresses.join(","),
|
||||
subject: decodeURIComponent(
|
||||
`${this.newSeat ? this.t("new_attendee") + ":" : ""} ${this.calEvent.title}`
|
||||
),
|
||||
subject: `${this.newSeat ? this.t("new_attendee") + ":" : ""} ${this.calEvent.title}`,
|
||||
html: renderEmail("OrganizerScheduledEmail", {
|
||||
calEvent: this.calEvent,
|
||||
attendee: this.calEvent.organizer,
|
||||
|
||||
Reference in new issue
Block a user