Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

feat: from address for a team's own email provider (#740)

André87e2759c7ac8
diff --git a/apps/api/src/modules/notification-settings/__tests__/integration/notification-settings.test.ts b/apps/api/src/modules/notification-settings/__tests__/integration/notification-settings.test.ts
index eb1db29a..e0e6bfe8 100644
--- a/apps/api/src/modules/notification-settings/__tests__/integration/notification-settings.test.ts
+++ b/apps/api/src/modules/notification-settings/__tests__/integration/notification-settings.test.ts
@@ -80,4 +80,18 @@ describe('notification settings', () => {
expect(res.status).toBe(200);
expect(res.data?.smtp).toMatchObject({ enabled: true, host: 'smtp.example.com' });
});
+
+ it('stores the From address and keeps it when a later save leaves it out', async () => {
+ const { api, teamId } = await ownedTeam();
+
+ const saved = await api.teams({ teamId })['notification-settings'].put({
+ smtp,
+ from: ' Parsec <[email protected]> ',
+ });
+ expect(saved.status).toBe(200);
+ expect(saved.data?.from).toBe('Parsec <[email protected]>');
+
+ const again = await api.teams({ teamId })['notification-settings'].put({ smtp });
+ expect(again.data?.from).toBe('Parsec <[email protected]>');
+ });
});
diff --git a/apps/api/src/modules/notification-settings/model.ts b/apps/api/src/modules/notification-settings/model.ts
index 226ed440..11720db4 100644
--- a/apps/api/src/modules/notification-settings/model.ts
+++ b/apps/api/src/modules/notification-settings/model.ts
@@ -22,6 +22,7 @@ export const NotificationSettingsResponse = t.Object({
timeout: t.Nullable(t.Number()),
}),
resend: t.Object({ enabled: t.Boolean(), hasApiKey: t.Boolean() }),
+ from: t.String(),
telegram: t.Object({ enabled: t.Boolean(), hasBotToken: t.Boolean() }),
});
@@ -41,5 +42,6 @@ export const NotificationSettingsBody = t.Object({
}),
),
resend: t.Optional(t.Object({ enabled: t.Boolean(), apiKey: t.Optional(t.String()) })),
+ from: t.Optional(t.String({ maxLength: 320 })),
telegram: t.Optional(t.Object({ enabled: t.Boolean(), botToken: t.Optional(t.String()) })),
});
diff --git a/apps/api/src/modules/notification-settings/service.ts b/apps/api/src/modules/notification-settings/service.ts
index 53a60f6e..58bde4dc 100644
--- a/apps/api/src/modules/notification-settings/service.ts
+++ b/apps/api/src/modules/notification-settings/service.ts
@@ -37,6 +37,7 @@ export interface NotificationSettingsDto {
timeout: number | null;
};
resend: { enabled: boolean; hasApiKey: boolean };
+ from: string;
telegram: { enabled: boolean; hasBotToken: boolean };
}
@@ -56,6 +57,7 @@ export interface NotificationSettingsPatch {
timeout: number | null;
};
resend?: { enabled: boolean; apiKey?: string };
+ from?: string;
telegram?: { enabled: boolean; botToken?: string };
}
@@ -72,6 +74,7 @@ function toDto(config: NotificationConfig): NotificationSettingsDto {
timeout: config.smtp.timeout,
},
resend: { enabled: config.resend.enabled, hasApiKey: config.resend.apiKey.length > 0 },
+ from: config.from,
telegram: {
enabled: config.telegram.enabled,
hasBotToken: config.telegram.botToken.length > 0,
@@ -95,6 +98,7 @@ function applyPatch(
system: { ...current.system },
smtp: { ...current.smtp },
resend: { ...current.resend },
+ from: current.from,
telegram: { ...current.telegram },
};
@@ -116,6 +120,7 @@ function applyPatch(
apiKey: mergeSecret(current.resend.apiKey, patch.resend.apiKey),
};
}
+ if (patch.from !== undefined) next.from = patch.from.trim();
if (patch.telegram) {
next.telegram = {
enabled: patch.telegram.enabled,
diff --git a/apps/web/messages/ar/teams.json b/apps/web/messages/ar/teams.json
index c07ebfe8..5d29106d 100644
--- a/apps/web/messages/ar/teams.json
+++ b/apps/web/messages/ar/teams.json
@@ -233,6 +233,8 @@
"timeout": "المهلة (ث)",
"optional": "اختياري",
"apiKey": "مفتاح API",
+ "from": "عنوان المرسِل",
+ "fromHint": "مطلوب مع Resend. ومع SMTP بيبقى اسم المستخدم افتراضيًا.",
"telegramBot": "بوت Telegram",
"telegramBotHint": "البوت الذي يوصّل الإشعارات لكل مشاريع الفريق. يختار كل عضو محادثته في تفضيلاته. يُخزَّن الرمز مشفَّرًا.",
"botToken": "رمز API للبوت (اختياري)",
diff --git a/apps/web/messages/en/teams.json b/apps/web/messages/en/teams.json
index 50cb349a..609d29c1 100644
--- a/apps/web/messages/en/teams.json
+++ b/apps/web/messages/en/teams.json
@@ -233,6 +233,8 @@
"timeout": "Timeout (s)",
"optional": "Optional",
"apiKey": "API key",
+ "from": "From address",
+ "fromHint": "Required for Resend. With SMTP it defaults to the username.",
"telegramBot": "Telegram bot",
"telegramBotHint": "The bot that delivers notifications for every project of the team. Members choose their own chat in their preferences. The token is stored encrypted.",
"botToken": "Bot API token (optional)",
diff --git a/apps/web/messages/es-ES/teams.json b/apps/web/messages/es-ES/teams.json
index e3be1b3b..b2a8d2ca 100644
--- a/apps/web/messages/es-ES/teams.json
+++ b/apps/web/messages/es-ES/teams.json
@@ -233,6 +233,8 @@
"timeout": "Tiempo de espera (s)",
"optional": "Opcional",
"apiKey": "Clave de API",
+ "from": "Dirección de remitente",
+ "fromHint": "Obligatoria para Resend. Con SMTP toma por defecto el nombre de usuario.",
"telegramBot": "Bot de Telegram",
"telegramBotHint": "El bot que entrega las notificaciones para cada proyecto del equipo. Los miembros eligen su propio chat en sus preferencias. El token se guarda cifrado.",
"botToken": "Token de la API del bot (opcional)",
diff --git a/apps/web/messages/fa/teams.json b/apps/web/messages/fa/teams.json
index 50a253cc..63e2a525 100644
--- a/apps/web/messages/fa/teams.json
+++ b/apps/web/messages/fa/teams.json
@@ -233,6 +233,8 @@
"timeout": "مهلت (ثانیه)",
"optional": "اختیاری",
"apiKey": "کلید API",
+ "from": "نشانی فرستنده",
+ "fromHint": "برای Resend الزامی است. با SMTP به‌طور پیش‌فرض نام کاربری است.",
"telegramBot": "ربات Telegram",
"telegramBotHint": "رباتی که اعلان‌ها را برای هر پروژه تیم ارسال می‌کند. اعضا چت خود را در تنظیمات شخصی انتخاب می‌کنند. توکن به‌صورت رمزنگاری‌شده ذخیره می‌شود.",
"botToken": "توکن API ربات (اختیاری)",
diff --git a/apps/web/messages/fr/teams.json b/apps/web/messages/fr/teams.json
index 182f7e2d..bf764038 100644
--- a/apps/web/messages/fr/teams.json
+++ b/apps/web/messages/fr/teams.json
@@ -233,6 +233,8 @@
"timeout": "Délai d'attente (s)",
"optional": "Facultatif",
"apiKey": "Clé d'API",
+ "from": "Adresse d'expédition",
+ "fromHint": "Obligatoire pour Resend. Avec SMTP, elle reprend le nom d'utilisateur par défaut.",
"telegramBot": "Bot Telegram",
"telegramBotHint": "Le bot qui envoie les notifications pour chaque projet de l'équipe. Les membres choisissent leur propre discussion dans leurs préférences. Le jeton est stocké chiffré.",
"botToken": "Token d'API du bot (facultatif)",
diff --git a/apps/web/messages/id/teams.json b/apps/web/messages/id/teams.json
index 7f70f8cf..f3b4643a 100644
--- a/apps/web/messages/id/teams.json
+++ b/apps/web/messages/id/teams.json
@@ -233,6 +233,8 @@
"timeout": "Batas waktu (dtk)",
"optional": "Opsional",
"apiKey": "Kunci API",
+ "from": "Alamat pengirim (From)",
+ "fromHint": "Wajib untuk Resend. Dengan SMTP, nilai bawaannya adalah nama pengguna.",
"telegramBot": "Bot Telegram",
"telegramBotHint": "Bot yang mengirimkan notifikasi untuk setiap proyek tim. Anggota memilih obrolan masing-masing di preferensi mereka. Token disimpan secara terenkripsi.",
"botToken": "Token API bot (opsional)",
diff --git a/apps/web/messages/ko/teams.json b/apps/web/messages/ko/teams.json
index 9de68d82..bde4e61b 100644
--- a/apps/web/messages/ko/teams.json
+++ b/apps/web/messages/ko/teams.json
@@ -233,6 +233,8 @@
"timeout": "시간 제한 (초)",
"optional": "선택 사항",
"apiKey": "API 키",
+ "from": "발신 주소",
+ "fromHint": "Resend에서는 필수입니다. SMTP에서는 기본적으로 사용자 이름이 사용됩니다.",
"telegramBot": "Telegram 봇",
"telegramBotHint": "팀의 모든 프로젝트에서 알림을 전송하는 봇입니다. 멤버는 각자의 환경 설정에서 자신의 채팅을 선택합니다. 토큰은 암호화되어 저장됩니다.",
"botToken": "봇 API 토큰 (선택 사항)",
diff --git a/apps/web/messages/pt-BR/teams.json b/apps/web/messages/pt-BR/teams.json
index c96c4875..22780747 100644
--- a/apps/web/messages/pt-BR/teams.json
+++ b/apps/web/messages/pt-BR/teams.json
@@ -233,6 +233,8 @@
"timeout": "Timeout (s)",
"optional": "Opcional",
"apiKey": "Chave de API",
+ "from": "Endereço de remetente",
+ "fromHint": "Obrigatório para Resend. Com SMTP, o padrão é o nome de usuário.",
"telegramBot": "Bot do Telegram",
"telegramBotHint": "O bot que entrega notificações para todos os projetos do time. Membros escolhem seu próprio chat em suas preferências. O token é armazenado criptografado.",
"botToken": "Token da API do bot (opcional)",
diff --git a/apps/web/messages/ru/teams.json b/apps/web/messages/ru/teams.json
index 6455384d..51ba8c69 100644
--- a/apps/web/messages/ru/teams.json
+++ b/apps/web/messages/ru/teams.json
@@ -233,6 +233,8 @@
"timeout": "Таймаут (с)",
"optional": "Необязательно",
"apiKey": "API-ключ",
+ "from": "Адрес отправителя",
+ "fromHint": "Обязателен для Resend. Для SMTP по умолчанию берётся имя пользователя.",
"telegramBot": "Telegram-бот",
"telegramBotHint": "Бот, который доставляет уведомления по всем проектам команды. Свой чат участник выбирает в настройках уведомлений. Токен хранится в зашифрованном виде.",
"botToken": "API-токен бота (необязательно)",
diff --git a/apps/web/messages/tr/teams.json b/apps/web/messages/tr/teams.json
index 3ea6bd14..cd1e2f5d 100644
--- a/apps/web/messages/tr/teams.json
+++ b/apps/web/messages/tr/teams.json
@@ -233,6 +233,8 @@
"timeout": "Zaman aşımı (sn)",
"optional": "İsteğe bağlı",
"apiKey": "API anahtarı",
+ "from": "Gönderen adresi",
+ "fromHint": "Resend için zorunludur. SMTP ile varsayılan olarak kullanıcı adını kullanır.",
"telegramBot": "Telegram botu",
"telegramBotHint": "Takımın her projesi için bildirimleri ileten bot. Üyeler kendi sohbetlerini tercihlerinden seçerler. Jeton şifrelenmiş olarak saklanır.",
"botToken": "Bot API jetonu (isteğe bağlı)",
diff --git a/apps/web/messages/uk/teams.json b/apps/web/messages/uk/teams.json
index c765392f..d39d51d4 100644
--- a/apps/web/messages/uk/teams.json
+++ b/apps/web/messages/uk/teams.json
@@ -233,6 +233,8 @@
"timeout": "Таймаут (с)",
"optional": "Необов'язково",
"apiKey": "API-ключ",
+ "from": "Адреса відправника",
+ "fromHint": "Обовʼязкова для Resend. Для SMTP типово береться імʼя користувача.",
"telegramBot": "Telegram-бот",
"telegramBotHint": "Бот, який доставляє сповіщення в усіх проєктах команди. Свій чат учасник обирає в налаштуваннях сповіщень. Токен зберігається в зашифрованому вигляді.",
"botToken": "API-токен бота (необов'язково)",
diff --git a/apps/web/messages/zh-CN/teams.json b/apps/web/messages/zh-CN/teams.json
index e6945530..10794ee2 100644
--- a/apps/web/messages/zh-CN/teams.json
+++ b/apps/web/messages/zh-CN/teams.json
@@ -233,6 +233,8 @@
"timeout": "超时(秒)",
"optional": "可选",
"apiKey": "API 密钥",
+ "from": "发件地址",
+ "fromHint": "Resend 必填;SMTP 默认使用用户名。",
"telegramBot": "Telegram 机器人",
"telegramBotHint": "为团队的所有项目投递通知的机器人。成员在自己的偏好设置中选择聊天。令牌以加密方式存储。",
"botToken": "Bot API 令牌(可选)",
diff --git a/apps/web/messages/zh-TW/teams.json b/apps/web/messages/zh-TW/teams.json
index f0b877de..e965c2bb 100644
--- a/apps/web/messages/zh-TW/teams.json
+++ b/apps/web/messages/zh-TW/teams.json
@@ -233,6 +233,8 @@
"timeout": "逾時(秒)",
"optional": "可選",
"apiKey": "API 金鑰",
+ "from": "寄件者地址",
+ "fromHint": "Resend 必填;SMTP 預設使用使用者名稱。",
"telegramBot": "Telegram 機器人",
"telegramBotHint": "為團隊的所有專案投遞通知的機器人。成員在自己的偏好設定中選擇聊天。權杖以加密方式儲存。",
"botToken": "Bot API 權杖(可選)",
diff --git a/apps/web/src/features/teams/components/notifications/EmailSettings.tsx b/apps/web/src/features/teams/components/notifications/EmailSettings.tsx
index 8a349a2a..aa3aff4f 100644
--- a/apps/web/src/features/teams/components/notifications/EmailSettings.tsx
+++ b/apps/web/src/features/teams/components/notifications/EmailSettings.tsx
@@ -35,6 +35,19 @@ export default function EmailSettings({ form }: { form: EmailForm }) {
options={['system', 'smtp', 'resend']}
/>
+ {form.provider !== 'system' && (
+ <div className="space-y-1.5 sm:max-w-md">
+ <Label htmlFor="email-from">{t('from')}</Label>
+ <Input
+ id="email-from"
+ value={form.from}
+ onChange={(e) => form.setFrom(e.target.value)}
+ placeholder={"It's a Plan <[email protected]>"}
+ />
+ <p className="text-xs text-muted-foreground">{t('fromHint')}</p>
+ </div>
+ )}
+
{form.provider === 'system' ? (
<p className="text-sm text-muted-foreground">
{settings.systemAvailable ? t('systemAvailable') : t('systemUnavailable')}
diff --git a/apps/web/src/features/teams/hooks/useEmailForm.ts b/apps/web/src/features/teams/hooks/useEmailForm.ts
index 033345be..7211b275 100644
--- a/apps/web/src/features/teams/hooks/useEmailForm.ts
+++ b/apps/web/src/features/teams/hooks/useEmailForm.ts
@@ -30,6 +30,8 @@ export interface EmailForm {
setTimeout: (v: string) => void;
apiKey: string;
setApiKey: (v: string) => void;
+ from: string;
+ setFrom: (v: string) => void;
settings: NotificationSettings;
dirty: boolean;
saving: boolean;
@@ -64,6 +66,7 @@ export function useEmailForm(teamId: number, settings: NotificationSettings): Em
const [password, setPassword] = useState('');
const [timeout, setTimeout] = useState(initialTimeout);
const [apiKey, setApiKey] = useState('');
+ const [from, setFrom] = useState(settings.from);
const smtpDirty =
host !== settings.smtp.host ||
@@ -75,6 +78,7 @@ export function useEmailForm(teamId: number, settings: NotificationSettings): Em
const dirty =
provider !== initialProvider ||
enabled !== initialEnabled ||
+ (provider !== 'system' && from !== settings.from) ||
(provider === 'smtp' ? smtpDirty : provider === 'resend' ? apiKey.length > 0 : false);
async function save() {
@@ -93,6 +97,7 @@ export function useEmailForm(teamId: number, settings: NotificationSettings): Em
enabled: provider === 'resend' && enabled,
...(apiKey.length > 0 ? { apiKey } : {}),
},
+ from: from.trim(),
});
setPassword('');
setApiKey('');
@@ -118,6 +123,8 @@ export function useEmailForm(teamId: number, settings: NotificationSettings): Em
setTimeout,
apiKey,
setApiKey,
+ from,
+ setFrom,
settings,
dirty,
saving: update.isPending,
diff --git a/apps/web/src/lib/api/endpoints/notificationSettings.ts b/apps/web/src/lib/api/endpoints/notificationSettings.ts
index e362ffaa..5b99fbd7 100644
--- a/apps/web/src/lib/api/endpoints/notificationSettings.ts
+++ b/apps/web/src/lib/api/endpoints/notificationSettings.ts
@@ -30,6 +30,7 @@ export interface NotificationSettings {
timeout: number | null;
};
resend: { enabled: boolean; hasApiKey: boolean };
+ from: string;
telegram: { enabled: boolean; hasBotToken: boolean };
}
@@ -47,6 +48,7 @@ export interface NotificationSettingsPatch {
timeout: number | null;
};
resend?: { enabled: boolean; apiKey?: string };
+ from?: string;
telegram?: { enabled: boolean; botToken?: string };
}
diff --git a/apps/worker/src/notification-send.ts b/apps/worker/src/notification-send.ts
index 7898f961..23560f10 100644
--- a/apps/worker/src/notification-send.ts
+++ b/apps/worker/src/notification-send.ts
@@ -45,7 +45,7 @@ async function sendNotificationEmail(input: SendInput): Promise<SendResult> {
? await getProjectEmailConfig()
: source === 'none'
? null
- : { smtp: input.config.smtp, resend: input.config.resend };
+ : { smtp: input.config.smtp, resend: input.config.resend, from: input.config.from };
if (!config) return { ok: false, retryable: false, error: 'email not configured' };
const { text, html } = emailBody(input.payload.text, input.payload.url);
return sendEmail(config, {
diff --git a/packages/db/src/domains/notification-settings.ts b/packages/db/src/domains/notification-settings.ts
index b17464eb..6af6e346 100644
--- a/packages/db/src/domains/notification-settings.ts
+++ b/packages/db/src/domains/notification-settings.ts
@@ -24,6 +24,9 @@ export interface NotificationConfig {
system: { enabled: boolean };
smtp: SmtpConfig;
resend: ResendConfig;
+ // The From address of the team's own SMTP or Resend provider. Empty falls back to
+ // EMAIL_FROM, then to the SMTP username.
+ from: string;
telegram: TelegramConfig;
}
@@ -42,6 +45,7 @@ export function defaultNotificationConfig(): NotificationConfig {
timeout: null,
},
resend: { enabled: false, apiKey: '' },
+ from: '',
telegram: { enabled: false, botToken: '' },
};
}