Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✨ Set the invite email's Reply-To to the host (#3167)

Luke Vellae84e55da8fd9
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index c3693fa68..0a8c7d895 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -779,6 +779,7 @@
"shareDialogNoInvitesDescription": "Enter an address above to send the first invite.",
"shareDialogNoInvitesTitle": "No one invited yet",
"shareDialogPollClosed": "Reopen the poll to send invites",
+ "shareDialogRepliesGoToYou": "Replies go to you",
"shareDialogSendFailed": "Couldn't send to {email}. Try again.",
"shareDialogSendInvite": "Send invite",
"showParticipantVotes": "Show participant votes",
diff --git a/apps/web/src/features/poll/components/invite-by-email.tsx b/apps/web/src/features/poll/components/invite-by-email.tsx
index 4a700f0a5..302beb6c7 100644
--- a/apps/web/src/features/poll/components/invite-by-email.tsx
+++ b/apps/web/src/features/poll/components/invite-by-email.tsx
@@ -260,7 +260,14 @@ export function InviteByEmail({ invites }: { invites: PollInviteListItem[] }) {
) : null}
</Button>
</form>
- {!isOpen ? (
+ {isOpen ? (
+ <p className="mt-2 text-muted-foreground text-sm">
+ <Trans
+ i18nKey="shareDialogRepliesGoToYou"
+ defaults="Replies go to you"
+ />
+ </p>
+ ) : (
<p
id="share-dialog-closed-reason"
className="mt-3 text-muted-foreground text-sm"
@@ -270,7 +277,7 @@ export function InviteByEmail({ invites }: { invites: PollInviteListItem[] }) {
defaults="Reopen the poll to send invites"
/>
</p>
- ) : null}
+ )}
<div className="mt-3">
{rows.length === 0 ? (
diff --git a/apps/web/src/features/poll/invite/mutations.ts b/apps/web/src/features/poll/invite/mutations.ts
index 4513a6de6..f67ad66ea 100644
--- a/apps/web/src/features/poll/invite/mutations.ts
+++ b/apps/web/src/features/poll/invite/mutations.ts
@@ -63,7 +63,7 @@ export async function sendPollInvite({
}),
prisma.user.findUnique({
where: { id: userId },
- select: { name: true, locale: true },
+ select: { name: true, email: true, locale: true },
}),
]);
@@ -179,6 +179,9 @@ export async function sendPollInvite({
try {
await sendPollInviteEmail({
to: email,
+ // Sent on the host's behalf, so replies go to them rather than the
+ // From address. Reply-To is outside DMARC alignment.
+ replyTo: sender.email,
locale: sender.locale ?? "en",
branding: poll.space
? await getSpaceBranding(poll.space)
diff --git a/apps/web/tests/email-invites.spec.ts b/apps/web/tests/email-invites.spec.ts
index 992b244a6..84776032f 100644
--- a/apps/web/tests/email-invites.spec.ts
+++ b/apps/web/tests/email-invites.spec.ts
@@ -90,6 +90,9 @@ test.describe("Email invites", () => {
);
expect(email.HTML).toContain("/invite/");
expect(email.HTML).toContain("?invite=");
+ // Replies reach the host, not the From address.
+ expect(email.ReplyTo.map((address) => address.Address)).toEqual([PRO_HOST]);
+ expect(email.HTML).toContain("Reply to this email to reach");
// Same address again is refused without sending.
await field.fill(INVITEE);
diff --git a/packages/emails/locales/en/emails.json b/packages/emails/locales/en/emails.json
index 8147aab25..425a4d55f 100644
--- a/packages/emails/locales/en/emails.json
+++ b/packages/emails/locales/en/emails.json
@@ -85,6 +85,7 @@
"pollInvite_content": "<b>{hostName}</b> is finding a time for <b>{pollTitle}</b> and wants to know when you're available.",
"pollInvite_heading": "You're invited",
"pollInvite_preview": "{hostName} wants to know when you're available",
+ "pollInvite_reply": "Reply to this email to reach {hostName}",
"pollInvite_subject": "{hostName} invited you to respond to {pollTitle}",
"register_codeValid": "This code is valid for 15 minutes",
"register_heading": "Verify your email address",
diff --git a/packages/emails/src/templates/poll-invite.test.tsx b/packages/emails/src/templates/poll-invite.test.tsx
new file mode 100644
index 000000000..c4bc84ee4
--- /dev/null
+++ b/packages/emails/src/templates/poll-invite.test.tsx
@@ -0,0 +1,18 @@
+import { render } from "@react-email/render";
+import { describe, expect, it } from "vitest";
+import { previewChrome } from "../components/preview-chrome";
+import PollInviteEmail from "./poll-invite";
+
+const baseProps = {
+ hostName: "Jessie Smith",
+ pollTitle: "Team offsite dates",
+ inviteUrl: "https://rallly.co/invite/abc123?invite=token",
+ chrome: previewChrome,
+};
+
+describe("PollInviteEmail", () => {
+ it("tells the invitee that replies reach the host", async () => {
+ const html = await render(await PollInviteEmail(baseProps));
+ expect(html).toContain("Reply to this email to reach");
+ });
+});
diff --git a/packages/emails/src/templates/poll-invite.tsx b/packages/emails/src/templates/poll-invite.tsx
index 4e05581d8..3ab39eaa2 100644
--- a/packages/emails/src/templates/poll-invite.tsx
+++ b/packages/emails/src/templates/poll-invite.tsx
@@ -66,6 +66,12 @@ async function PollInviteEmail({
<Button href={inviteUrl} id="inviteUrl" color={chrome.primaryColor}>
{t("pollInvite_button", { defaultValue: "Respond" })}
</Button>
+ <Text light={true}>
+ {t("pollInvite_reply", {
+ defaultValue: "Reply to this email to reach {hostName}",
+ hostName,
+ })}
+ </Text>
<Hr style={{ margin: "16px 0" }} />
<PoweredBy chrome={chrome} locale={locale} />
</Container>