From 3e10e2db3666103d563c48ab9e7eafe611fbcb6a Mon Sep 17 00:00:00 2001 From: Dilpreet Singh Date: Fri, 28 Jun 2024 02:55:13 +0530 Subject: [PATCH] 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 Co-authored-by: Keith Williams --- .env.example | 1 + packages/emails/templates/account-verify-email.ts | 4 ++-- packages/emails/templates/admin-organization-notification.ts | 4 ++-- packages/emails/templates/attendee-request-email.ts | 4 ++-- packages/emails/templates/attendee-verify-email.ts | 4 ++-- .../templates/attendee-was-requested-to-reschedule-email.ts | 4 ++-- packages/emails/templates/booking-redirect-notification.ts | 4 ++-- packages/emails/templates/broken-integration-email.ts | 4 ++-- packages/emails/templates/change-account-email-verify.ts | 4 ++-- packages/emails/templates/disabled-app-email.ts | 4 ++-- packages/emails/templates/feedback-email.ts | 4 ++-- packages/emails/templates/forgot-password-email.ts | 4 ++-- packages/emails/templates/monthly-digest-email.ts | 4 ++-- packages/emails/templates/org-auto-join-invite.ts | 4 ++-- .../emails/templates/organization-admin-no-slots-email.ts | 4 ++-- packages/emails/templates/organization-creation-email.ts | 4 ++-- packages/emails/templates/organization-email-verification.ts | 4 ++-- .../templates/organizer-attendee-cancelled-seat-email.ts | 4 ++-- packages/emails/templates/organizer-cancelled-email.ts | 4 ++-- .../organizer-daily-video-download-recording-email.ts | 4 ++-- .../organizer-daily-video-download-transcript-email.ts | 4 ++-- packages/emails/templates/organizer-location-change-email.ts | 4 ++-- .../emails/templates/organizer-payment-refund-failed-email.ts | 4 ++-- packages/emails/templates/organizer-request-email.ts | 4 ++-- packages/emails/templates/organizer-request-reminder-email.ts | 4 ++-- .../templates/organizer-requested-to-reschedule-email.ts | 4 ++-- packages/emails/templates/organizer-rescheduled-email.ts | 4 ++-- packages/emails/templates/organizer-scheduled-email.ts | 4 ++-- packages/emails/templates/slug-replacement-email.ts | 4 ++-- packages/emails/templates/team-invite-email.ts | 4 ++-- packages/lib/constants.ts | 1 + packages/types/environment.d.ts | 1 + turbo.json | 1 + 33 files changed, 62 insertions(+), 58 deletions(-) diff --git a/.env.example b/.env.example index fe36f11116..08c44c5c3b 100644 --- a/.env.example +++ b/.env.example @@ -180,6 +180,7 @@ API_KEY_PREFIX=cal_ # allow access to the nodemailer transports from the .env file. E-mail templates are accessible within lib/emails/ # Configures the global From: header whilst sending emails. EMAIL_FROM='notifications@yourselfhostedcal.com' +EMAIL_FROM_NAME='Cal.com' # Configure SMTP settings (@see https://nodemailer.com/smtp/). # Configuration to receive emails locally (mailhog) diff --git a/packages/emails/templates/account-verify-email.ts b/packages/emails/templates/account-verify-email.ts index 6c8871ec88..cbad2a6b1b 100644 --- a/packages/emails/templates/account-verify-email.ts +++ b/packages/emails/templates/account-verify-email.ts @@ -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, }), diff --git a/packages/emails/templates/admin-organization-notification.ts b/packages/emails/templates/admin-organization-notification.ts index 01b6f469ab..7c277a04f8 100644 --- a/packages/emails/templates/admin-organization-notification.ts +++ b/packages/emails/templates/admin-organization-notification.ts @@ -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> { 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", { diff --git a/packages/emails/templates/attendee-request-email.ts b/packages/emails/templates/attendee-request-email.ts index 3f5d555b7c..24e36538e4 100644 --- a/packages/emails/templates/attendee-request-email.ts +++ b/packages/emails/templates/attendee-request-email.ts @@ -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", { diff --git a/packages/emails/templates/attendee-verify-email.ts b/packages/emails/templates/attendee-verify-email.ts index 2c34a49cc8..5024fe0089 100644 --- a/packages/emails/templates/attendee-verify-email.ts +++ b/packages/emails/templates/attendee-verify-email.ts @@ -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> { 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" : ""}`, { diff --git a/packages/emails/templates/attendee-was-requested-to-reschedule-email.ts b/packages/emails/templates/attendee-was-requested-to-reschedule-email.ts index 09310c816c..579f46a947 100644 --- a/packages/emails/templates/attendee-was-requested-to-reschedule-email.ts +++ b/packages/emails/templates/attendee-was-requested-to-reschedule-email.ts @@ -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, diff --git a/packages/emails/templates/booking-redirect-notification.ts b/packages/emails/templates/booking-redirect-notification.ts index 6a6a97c1ea..5630c01ec9 100644 --- a/packages/emails/templates/booking-redirect-notification.ts +++ b/packages/emails/templates/booking-redirect-notification.ts @@ -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> { 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, diff --git a/packages/emails/templates/broken-integration-email.ts b/packages/emails/templates/broken-integration-email.ts index b1aaddb175..14555256ce 100644 --- a/packages/emails/templates/broken-integration-email.ts +++ b/packages/emails/templates/broken-integration-email.ts @@ -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, diff --git a/packages/emails/templates/change-account-email-verify.ts b/packages/emails/templates/change-account-email-verify.ts index 5184fb057f..e5c75230f8 100644 --- a/packages/emails/templates/change-account-email-verify.ts +++ b/packages/emails/templates/change-account-email-verify.ts @@ -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> { 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, }), diff --git a/packages/emails/templates/disabled-app-email.ts b/packages/emails/templates/disabled-app-email.ts index cd85295448..85c75bbd61 100644 --- a/packages/emails/templates/disabled-app-email.ts +++ b/packages/emails/templates/disabled-app-email.ts @@ -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> { return { - from: `${APP_NAME} <${this.getMailerOptions().from}>`, + from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`, to: this.email, subject: this.title && this.eventTypeId diff --git a/packages/emails/templates/feedback-email.ts b/packages/emails/templates/feedback-email.ts index 4eef2a9f34..591a380718 100644 --- a/packages/emails/templates/feedback-email.ts +++ b/packages/emails/templates/feedback-email.ts @@ -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> { 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), diff --git a/packages/emails/templates/forgot-password-email.ts b/packages/emails/templates/forgot-password-email.ts index 7f041693b7..2fde8e3baf 100644 --- a/packages/emails/templates/forgot-password-email.ts +++ b/packages/emails/templates/forgot-password-email.ts @@ -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> { 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, }), diff --git a/packages/emails/templates/monthly-digest-email.ts b/packages/emails/templates/monthly-digest-email.ts index 629b389329..2eaaf4d27a 100644 --- a/packages/emails/templates/monthly-digest-email.ts +++ b/packages/emails/templates/monthly-digest-email.ts @@ -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> { 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), diff --git a/packages/emails/templates/org-auto-join-invite.ts b/packages/emails/templates/org-auto-join-invite.ts index 64a2811ec6..c295eca9d8 100644 --- a/packages/emails/templates/org-auto-join-invite.ts +++ b/packages/emails/templates/org-auto-join-invite.ts @@ -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> { 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, diff --git a/packages/emails/templates/organization-admin-no-slots-email.ts b/packages/emails/templates/organization-admin-no-slots-email.ts index a99b48daff..e929b2fc50 100644 --- a/packages/emails/templates/organization-admin-no-slots-email.ts +++ b/packages/emails/templates/organization-admin-no-slots-email.ts @@ -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> { 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), diff --git a/packages/emails/templates/organization-creation-email.ts b/packages/emails/templates/organization-creation-email.ts index c6d5de4b44..c6adc77430 100644 --- a/packages/emails/templates/organization-creation-email.ts +++ b/packages/emails/templates/organization-creation-email.ts @@ -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> { 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: "", diff --git a/packages/emails/templates/organization-email-verification.ts b/packages/emails/templates/organization-email-verification.ts index 89cfec56f4..0722662477 100644 --- a/packages/emails/templates/organization-email-verification.ts +++ b/packages/emails/templates/organization-email-verification.ts @@ -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> { 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), diff --git a/packages/emails/templates/organizer-attendee-cancelled-seat-email.ts b/packages/emails/templates/organizer-attendee-cancelled-seat-email.ts index 5fa17765b1..86246335f5 100644 --- a/packages/emails/templates/organizer-attendee-cancelled-seat-email.ts +++ b/packages/emails/templates/organizer-attendee-cancelled-seat-email.ts @@ -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, diff --git a/packages/emails/templates/organizer-cancelled-email.ts b/packages/emails/templates/organizer-cancelled-email.ts index 3466cab5c2..8b3597ca6a 100644 --- a/packages/emails/templates/organizer-cancelled-email.ts +++ b/packages/emails/templates/organizer-cancelled-email.ts @@ -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, diff --git a/packages/emails/templates/organizer-daily-video-download-recording-email.ts b/packages/emails/templates/organizer-daily-video-download-recording-email.ts index 34e1549132..6aeba56175 100644 --- a/packages/emails/templates/organizer-daily-video-download-recording-email.ts +++ b/packages/emails/templates/organizer-daily-video-download-recording-email.ts @@ -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> { 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, diff --git a/packages/emails/templates/organizer-daily-video-download-transcript-email.ts b/packages/emails/templates/organizer-daily-video-download-transcript-email.ts index a491ecf278..058b48d954 100644 --- a/packages/emails/templates/organizer-daily-video-download-transcript-email.ts +++ b/packages/emails/templates/organizer-daily-video-download-transcript-email.ts @@ -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> { 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, diff --git a/packages/emails/templates/organizer-location-change-email.ts b/packages/emails/templates/organizer-location-change-email.ts index c5c8e893c0..9cfd14a544 100644 --- a/packages/emails/templates/organizer-location-change-email.ts +++ b/packages/emails/templates/organizer-location-change-email.ts @@ -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", { diff --git a/packages/emails/templates/organizer-payment-refund-failed-email.ts b/packages/emails/templates/organizer-payment-refund-failed-email.ts index fd907ba1b5..5100e4f8f2 100644 --- a/packages/emails/templates/organizer-payment-refund-failed-email.ts +++ b/packages/emails/templates/organizer-payment-refund-failed-email.ts @@ -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, diff --git a/packages/emails/templates/organizer-request-email.ts b/packages/emails/templates/organizer-request-email.ts index 47b82627f5..d4f3feb372 100644 --- a/packages/emails/templates/organizer-request-email.ts +++ b/packages/emails/templates/organizer-request-email.ts @@ -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}`, diff --git a/packages/emails/templates/organizer-request-reminder-email.ts b/packages/emails/templates/organizer-request-reminder-email.ts index b8d5130a7a..8b28d49bba 100644 --- a/packages/emails/templates/organizer-request-reminder-email.ts +++ b/packages/emails/templates/organizer-request-reminder-email.ts @@ -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", { diff --git a/packages/emails/templates/organizer-requested-to-reschedule-email.ts b/packages/emails/templates/organizer-requested-to-reschedule-email.ts index 8a5e5247b7..3c62aa6f02 100644 --- a/packages/emails/templates/organizer-requested-to-reschedule-email.ts +++ b/packages/emails/templates/organizer-requested-to-reschedule-email.ts @@ -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, diff --git a/packages/emails/templates/organizer-rescheduled-email.ts b/packages/emails/templates/organizer-rescheduled-email.ts index ed63aa8fcc..3b7013ac34 100644 --- a/packages/emails/templates/organizer-rescheduled-email.ts +++ b/packages/emails/templates/organizer-rescheduled-email.ts @@ -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", { diff --git a/packages/emails/templates/organizer-scheduled-email.ts b/packages/emails/templates/organizer-scheduled-email.ts index 5e8e27f283..347345704d 100644 --- a/packages/emails/templates/organizer-scheduled-email.ts +++ b/packages/emails/templates/organizer-scheduled-email.ts @@ -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}`, diff --git a/packages/emails/templates/slug-replacement-email.ts b/packages/emails/templates/slug-replacement-email.ts index e7943300db..90133beee2 100644 --- a/packages/emails/templates/slug-replacement-email.ts +++ b/packages/emails/templates/slug-replacement-email.ts @@ -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> { 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", { diff --git a/packages/emails/templates/team-invite-email.ts b/packages/emails/templates/team-invite-email.ts index 339e2e38c7..145a4b44e2 100644 --- a/packages/emails/templates/team-invite-email.ts +++ b/packages/emails/templates/team-invite-email.ts @@ -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> { 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: "", diff --git a/packages/lib/constants.ts b/packages/lib/constants.ts index 5deb46ea7c..2da6880fbf 100644 --- a/packages/lib/constants.ts +++ b/packages/lib/constants.ts @@ -28,6 +28,7 @@ export const SUPPORT_MAIL_ADDRESS = process.env.NEXT_PUBLIC_SUPPORT_MAIL_ADDRESS export const COMPANY_NAME = process.env.NEXT_PUBLIC_COMPANY_NAME || "Cal.com, Inc."; export const SENDER_ID = process.env.NEXT_PUBLIC_SENDER_ID || "Cal"; export const SENDER_NAME = process.env.NEXT_PUBLIC_SENDGRID_SENDER_NAME || "Cal.com"; +export const EMAIL_FROM_NAME = process.env.EMAIL_FROM_NAME || APP_NAME; // This is the URL from which all Cal Links and their assets are served. // Use website URL to make links shorter(cal.com and not app.cal.com) diff --git a/packages/types/environment.d.ts b/packages/types/environment.d.ts index caee882791..9706f44b08 100644 --- a/packages/types/environment.d.ts +++ b/packages/types/environment.d.ts @@ -17,6 +17,7 @@ declare namespace NodeJS { readonly ZOOM_CLIENT_ID: string | undefined; readonly ZOOM_CLIENT_SECRET: string | undefined; readonly EMAIL_FROM: string | undefined; + readonly EMAIL_FROM_NAME: string | undefined; readonly EMAIL_SERVER_HOST: string | undefined; readonly EMAIL_SERVER_PORT: string | undefined; readonly EMAIL_SERVER_USER: string | undefined; diff --git a/turbo.json b/turbo.json index 0433b1f8c4..91cd8b5f7e 100644 --- a/turbo.json +++ b/turbo.json @@ -278,6 +278,7 @@ "E2E_TEST_SAML_ADMIN_EMAIL", "E2E_TEST_SAML_ADMIN_PASSWORD", "EMAIL_FROM", + "EMAIL_FROM_NAME", "EMAIL_SERVER_HOST", "EMAIL_SERVER_PASSWORD", "EMAIL_SERVER_PORT",