mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
* feat(server): album's email notification * same size button * skeleton for album invite and album update event * album invite content * album update * fix(server): smtp certificate validation (#9506) * album update content * send mail * album invite with thumbnail * pr feedback * styling * Send email to update album event * better naming * add tests * Update album-invite.email.tsx Co-authored-by: bo0tzz <git@bo0tzz.me> * Update album-update.email.tsx Co-authored-by: bo0tzz <git@bo0tzz.me> * fix: unit tests * typo * Update server/src/services/notification.service.ts Co-authored-by: Jason Rasmussen <jrasm91@gmail.com> * PR feedback * Update server/src/emails/album-update.email.tsx Co-authored-by: Zack Pollard <zackpollard@ymail.com> --------- Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Co-authored-by: bo0tzz <git@bo0tzz.me> Co-authored-by: Jason Rasmussen <jrasm91@gmail.com> Co-authored-by: Zack Pollard <zackpollard@ymail.com>
86 lines
1.7 KiB
TypeScript
86 lines
1.7 KiB
TypeScript
export const INotificationRepository = 'INotificationRepository';
|
|
|
|
export type EmailImageAttachment = {
|
|
filename: string;
|
|
path: string;
|
|
cid: string;
|
|
};
|
|
|
|
export type SendEmailOptions = {
|
|
from: string;
|
|
to: string;
|
|
replyTo?: string;
|
|
subject: string;
|
|
html: string;
|
|
text: string;
|
|
imageAttachments?: EmailImageAttachment[];
|
|
smtp: SmtpOptions;
|
|
};
|
|
|
|
export type SmtpOptions = {
|
|
host: string;
|
|
port?: number;
|
|
username?: string;
|
|
password?: string;
|
|
ignoreCert?: boolean;
|
|
};
|
|
|
|
export enum EmailTemplate {
|
|
// AUTH
|
|
WELCOME = 'welcome',
|
|
RESET_PASSWORD = 'reset-password',
|
|
|
|
// ALBUM
|
|
ALBUM_INVITE = 'album-invite',
|
|
ALBUM_UPDATE = 'album-update',
|
|
}
|
|
|
|
interface BaseEmailProps {
|
|
baseUrl: string;
|
|
}
|
|
|
|
export interface WelcomeEmailProps extends BaseEmailProps {
|
|
displayName: string;
|
|
username: string;
|
|
password?: string;
|
|
}
|
|
|
|
export interface AlbumInviteEmailProps extends BaseEmailProps {
|
|
albumName: string;
|
|
albumId: string;
|
|
senderName: string;
|
|
recipientName: string;
|
|
cid?: string;
|
|
}
|
|
|
|
export interface AlbumUpdateEmailProps extends BaseEmailProps {
|
|
albumName: string;
|
|
albumId: string;
|
|
recipientName: string;
|
|
cid?: string;
|
|
}
|
|
|
|
export type EmailRenderRequest =
|
|
| {
|
|
template: EmailTemplate.WELCOME;
|
|
data: WelcomeEmailProps;
|
|
}
|
|
| {
|
|
template: EmailTemplate.ALBUM_INVITE;
|
|
data: AlbumInviteEmailProps;
|
|
}
|
|
| {
|
|
template: EmailTemplate.ALBUM_UPDATE;
|
|
data: AlbumUpdateEmailProps;
|
|
};
|
|
|
|
export type SendEmailResponse = {
|
|
messageId: string;
|
|
response: any;
|
|
};
|
|
|
|
export interface INotificationRepository {
|
|
renderEmail(request: EmailRenderRequest): { html: string; text: string };
|
|
sendEmail(options: SendEmailOptions): Promise<SendEmailResponse>;
|
|
verifySmtp(options: SmtpOptions): Promise<true>;
|
|
}
|