feat: adds env variable for email sender name (#15598)

* feat: adds env variable for email sender name

* update env declaration file

---------

Co-authored-by: unknown <[email protected]>
Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-06-27 18:25:13 -03:00
1 parent dfbcf4742f
commit 3e10e2db36
33 files changed
+62 -58

No files matched your search

@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME, COMPANY_NAME } from "@calcom/lib/constants";
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import BaseEmail from "./_base-email";
@@ -30,7 +30,7 @@ export default class AccountVerifyEmail extends BaseEmail {
: "verify_email_subject";
return {
to: `${this.verifyAccountInput.user.name} <${this.verifyAccountInput.user.email}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
subject: this.verifyAccountInput.language(emailSubjectKey, {
appName: APP_NAME,
}),
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import BaseEmail from "./_base-email";
@@ -24,7 +24,7 @@ export default class AdminOrganizationNotification extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: this.input.instanceAdmins.map((admin) => admin.email).join(","),
subject: `${this.input.t("admin_org_notification_email_subject")}`,
html: await renderEmail("AdminOrganizationNotificationEmail", {
@@ -1,4 +1,4 @@
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import AttendeeScheduledEmail from "./attendee-scheduled-email";
@@ -8,7 +8,7 @@ export default class AttendeeRequestEmail extends AttendeeScheduledEmail {
const toAddresses = this.calEvent.attendees.map((attendee) => attendee.email);
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
replyTo: [...this.calEvent.attendees.map(({ email }) => email), this.calEvent.organizer.email],
subject: `${this.calEvent.attendees[0].language.translate("booking_submitted_subject", {
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME, COMPANY_NAME } from "@calcom/lib/constants";
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import BaseEmail from "./_base-email";
@@ -27,7 +27,7 @@ export default class AttendeeVerifyEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.verifyAccountInput.user.name} <${this.verifyAccountInput.user.email}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
subject: this.verifyAccountInput.language(
`verify_email_subject${this.verifyAccountInput.isVerifyingEmail ? "_verifying_email" : ""}`,
{
@@ -1,5 +1,5 @@
import { getManageLink } from "@calcom/lib/CalEventParser";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import type { CalendarEvent } from "@calcom/types/Calendar";
import { renderEmail } from "..";
@@ -30,7 +30,7 @@ export default class AttendeeWasRequestedToRescheduleEmail extends OrganizerSche
}),
method: "REQUEST",
},
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
subject: `${this.t("requested_to_reschedule_subject_attendee", {
eventType: this.calEvent.type,
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "..";
import BaseEmail from "./_base-email";
@@ -25,7 +25,7 @@ export default class BookingRedirectNotification extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.bookingRedirect.toName} <${this.bookingRedirect.toEmail}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
subject: this.bookingRedirect.language("booking_redirect_email_subject"),
html: await renderEmail("BookingRedirectEmailNotification", {
...this.bookingRedirect,
@@ -1,7 +1,7 @@
import type { TFunction } from "next-i18next";
import { getRichDescription } from "@calcom/lib/CalEventParser";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { TimeFormat } from "@calcom/lib/timeFormat";
import type { CalendarEvent } from "@calcom/types/Calendar";
@@ -25,7 +25,7 @@ export default class BrokenIntegrationEmail extends BaseEmail {
const toAddresses = [this.calEvent.organizer.email];
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
subject: `[Action Required] ${this.t("confirmed_event_type_subject", {
eventType: this.calEvent.type,
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME, COMPANY_NAME } from "@calcom/lib/constants";
import { APP_NAME, COMPANY_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import BaseEmail from "./_base-email";
@@ -27,7 +27,7 @@ export default class ChangeOfEmailVerifyEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.changeEvent.user.name} <${this.changeEvent.user.emailTo}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
subject: this.changeEvent.language("change_of_email", {
appName: APP_NAME,
}),
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "..";
import BaseEmail from "./_base-email";
@@ -32,7 +32,7 @@ export default class DisabledAppEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: this.email,
subject:
this.title && this.eventTypeId
+2 -2
View File
@@ -1,4 +1,4 @@
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import BaseEmail from "./_base-email";
@@ -20,7 +20,7 @@ export default class FeedbackEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: process.env.SEND_FEEDBACK_EMAIL,
subject: `User Feedback`,
html: await renderEmail("FeedbackEmail", this.feedback),
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import BaseEmail from "./_base-email";
@@ -26,7 +26,7 @@ export default class ForgotPasswordEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.passwordEvent.user.name} <${this.passwordEvent.user.email}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
subject: this.passwordEvent.language("reset_password_subject", {
appName: APP_NAME,
}),
@@ -1,4 +1,4 @@
import { APP_NAME } from "@calcom/lib/constants";
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import type { MonthlyDigestEmailData } from "../src/templates/MonthlyDigestEmail";
@@ -14,7 +14,7 @@ export default class MonthlyDigestEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: this.eventData.admin.email,
subject: `${APP_NAME}: Your monthly digest`,
html: await renderEmail("MonthlyDigestEmail", this.eventData),
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "..";
import BaseEmail from "./_base-email";
@@ -25,7 +25,7 @@ export default class OrgAutoJoinEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: this.orgAutoInviteEvent.to,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
subject: this.orgAutoInviteEvent.language("user_invited_you", {
user: this.orgAutoInviteEvent.from,
team: this.orgAutoInviteEvent.orgName,
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import renderEmail from "../src/renderEmail";
import BaseEmail from "./_base-email";
@@ -27,7 +27,7 @@ export default class OrganizationAdminNoSlotsEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: this.adminNoSlots.to.email,
subject: this.adminNoSlots.language("org_admin_no_slots|subject", { name: this.adminNoSlots.user }),
html: await renderEmail("OrganizationAdminNoSlotsEmail", this.adminNoSlots),
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import BaseEmail from "./_base-email";
@@ -29,7 +29,7 @@ export default class OrganizationCreationEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: this.organizationCreationEvent.to,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
subject: this.organizationCreationEvent.language(`email_organization_created|subject`),
html: await renderEmail("OrganizationCreationEmail", this.organizationCreationEvent),
text: "",
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import renderEmail from "../src/renderEmail";
import BaseEmail from "./_base-email";
@@ -24,7 +24,7 @@ export default class OrganizationEmailVerification extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: this.orgVerifyInput.user.email,
subject: this.orgVerifyInput.language("verify_email_organization"),
html: await renderEmail("OrganisationAccountVerifyEmail", this.orgVerifyInput),
@@ -1,4 +1,4 @@
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
@@ -16,7 +16,7 @@ export default class OrganizerCancelledEmail extends OrganizerScheduledEmail {
}
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
subject: `${this.t("event_cancelled_subject", {
title: this.calEvent.title,
@@ -1,4 +1,4 @@
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import generateIcsString from "../lib/generateIcsString";
@@ -20,7 +20,7 @@ export default class OrganizerCancelledEmail extends OrganizerScheduledEmail {
}),
method: "REQUEST",
},
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
subject: `${this.t("event_cancelled_subject", {
title: this.calEvent.title,
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { TimeFormat } from "@calcom/lib/timeFormat";
import type { CalendarEvent } from "@calcom/types/Calendar";
@@ -22,7 +22,7 @@ export default class OrganizerDailyVideoDownloadRecordingEmail extends BaseEmail
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.calEvent.organizer.email}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
replyTo: [...this.calEvent.attendees.map(({ email }) => email), this.calEvent.organizer.email],
subject: `${this.t("download_recording_subject", {
title: this.calEvent.title,
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { TimeFormat } from "@calcom/lib/timeFormat";
import type { CalendarEvent } from "@calcom/types/Calendar";
@@ -22,7 +22,7 @@ export default class OrganizerDailyVideoDownloadTranscriptEmail extends BaseEmai
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.calEvent.organizer.email}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
replyTo: [...this.calEvent.attendees.map(({ email }) => email), this.calEvent.organizer.email],
subject: `${this.t("download_transcript_email_subject", {
title: this.calEvent.title,
@@ -1,4 +1,4 @@
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import generateIcsString from "../lib/generateIcsString";
@@ -20,7 +20,7 @@ export default class OrganizerLocationChangeEmail extends OrganizerScheduledEmai
}),
method: "REQUEST",
},
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
replyTo: [this.calEvent.organizer.email, ...this.calEvent.attendees.map(({ email }) => email)],
subject: `${this.t("location_changed_event_type_subject", {
@@ -1,4 +1,4 @@
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
@@ -8,7 +8,7 @@ export default class OrganizerPaymentRefundFailedEmail extends OrganizerSchedule
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
subject: `${this.t("refund_failed_subject", {
eventType: this.calEvent.type,
@@ -1,4 +1,4 @@
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
@@ -8,7 +8,7 @@ export default class OrganizerRequestEmail extends OrganizerScheduledEmail {
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
replyTo: [this.calEvent.organizer.email, ...this.calEvent.attendees.map(({ email }) => email)],
subject: `${this.t("awaiting_approval")}: ${this.calEvent.title}`,
@@ -1,4 +1,4 @@
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import OrganizerRequestEmail from "./organizer-request-email";
@@ -8,7 +8,7 @@ export default class OrganizerRequestReminderEmail extends OrganizerRequestEmail
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
replyTo: [this.calEvent.organizer.email, ...this.calEvent.attendees.map(({ email }) => email)],
subject: `${this.t("event_awaiting_approval_subject", {
@@ -3,7 +3,7 @@ import { createEvent } from "ics";
import dayjs from "@calcom/dayjs";
import { getRichDescription } from "@calcom/lib/CalEventParser";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import type { CalendarEvent } from "@calcom/types/Calendar";
import { renderEmail } from "..";
@@ -35,7 +35,7 @@ export default class OrganizerRequestedToRescheduleEmail extends OrganizerSchedu
}),
method: "REQUEST",
},
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
subject: `${this.t("rescheduled_event_type_subject", {
eventType: this.calEvent.type,
@@ -1,4 +1,4 @@
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import generateIcsString from "../lib/generateIcsString";
@@ -20,7 +20,7 @@ export default class OrganizerRescheduledEmail extends OrganizerScheduledEmail {
}),
method: "REQUEST",
},
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
replyTo: [this.calEvent.organizer.email, ...this.calEvent.attendees.map(({ email }) => email)],
subject: `${this.calEvent.organizer.language.translate("event_type_has_been_rescheduled_on_time_date", {
@@ -3,7 +3,7 @@ import { cloneDeep } from "lodash";
import type { TFunction } from "next-i18next";
import { getRichDescription } from "@calcom/lib/CalEventParser";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { TimeFormat } from "@calcom/lib/timeFormat";
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
@@ -44,7 +44,7 @@ export default class OrganizerScheduledEmail extends BaseEmail {
}),
method: "REQUEST",
},
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
replyTo: [this.calEvent.organizer.email, ...this.calEvent.attendees.map(({ email }) => email)],
subject: `${this.newSeat ? `${this.t("new_attendee")}: ` : ""}${this.calEvent.title}`,
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "..";
import BaseEmail from "./_base-email";
@@ -23,7 +23,7 @@ export default class SlugReplacementEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
to: this.email,
subject: this.t("email_subject_slug_replacement", { slug: this.slug }),
html: await renderEmail("SlugReplacementEmail", {
@@ -1,6 +1,6 @@
import type { TFunction } from "next-i18next";
import { APP_NAME } from "@calcom/lib/constants";
import { APP_NAME, EMAIL_FROM_NAME } from "@calcom/lib/constants";
import { renderEmail } from "../";
import BaseEmail from "./_base-email";
@@ -72,7 +72,7 @@ export default class TeamInviteEmail extends BaseEmail {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: this.teamInviteEvent.to,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
subject: getSubject(this.teamInviteEvent),
html: await renderEmail("TeamInviteEmail", this.teamInviteEvent),
text: "",