diff --git a/apps/api/src/mail/services/interface.service.ts b/apps/api/src/mail/services/interface.service.ts index 7f4e2689..53178b77 100644 --- a/apps/api/src/mail/services/interface.service.ts +++ b/apps/api/src/mail/services/interface.service.ts @@ -18,4 +18,13 @@ export interface IMailService { adminUserCreateEmail(email: string): Promise feedbackEmail(email: string, feedback: string): Promise + + userInvitation( + email: string, + projectName: string, + projectUrl: string, + invitedBy: string, + invitedOn: string, + invitationRole: string + ): Promise } diff --git a/apps/api/src/mail/services/mail.service.ts b/apps/api/src/mail/services/mail.service.ts index d216f705..6e615f7d 100644 --- a/apps/api/src/mail/services/mail.service.ts +++ b/apps/api/src/mail/services/mail.service.ts @@ -158,6 +158,190 @@ export class MailService implements IMailService { await this.sendEmail(email, subject, body) } + async userInvitation( + email: string, + projectName: string, + projectUrl: string, + invitedBy: string, + invitedOn: string, + invitationRole: string + ): Promise { + const subject = `You're Invited to Join ${projectName} on Keyshade` + const body = ` + + + + + Project Invitation + + + + + + + + + + + + + + ` + + await this.sendEmail(email, subject, body) + } + private async sendEmail( email: string, subject: string, diff --git a/apps/api/src/mail/services/mock.service.ts b/apps/api/src/mail/services/mock.service.ts index 003cb520..f874651b 100644 --- a/apps/api/src/mail/services/mock.service.ts +++ b/apps/api/src/mail/services/mock.service.ts @@ -38,4 +38,17 @@ export class MockMailService implements IMailService { async sendEmailChangedOtp(email: string, otp: string): Promise { this.log.log(`Email change OTP for email ${email} is ${otp}`) } + + async userInvitation( + email: string, + projectName: string, + projectUrl: string, + invitedBy: string, + invitedOn: string, + invitationRole: string + ): Promise { + this.log.log( + `User ${email} has been invited to the project ${projectName} by ${invitedBy} on ${invitedOn} as a ${invitationRole}. Project details can be accessed at ${projectUrl}.` + ) + } }