import { Injectable, Post, Body } from '@nestjs/common'; import { MailerService } from '@nestjs-modules/mailer'; @Injectable() export class EmailService { constructor(private mailerService: MailerService) {} async sendWelcomeEmail(email: string, name: string) { await this.mailerService.sendMail({ to: email, subject: 'Welcome to IMK Platform', html: `
Dear ${name},
Thank you for joining IMK Platform. Your account has been created successfully.
You can now log in to access your documents and start collaborating with your team.
If you have any questions or need assistance, please don't hesitate to contact our support team.
Best regards,
IMK Team
Click the link below to reset your password:
Reset PasswordThis link will expire in 1 hour.
`, }); } async sendDocumentSharedNotification(email: string, documentTitle: string, sharedByName: string) { await this.mailerService.sendMail({ to: email, subject: 'New Document Shared With You', html: `${sharedByName} has shared a document with you: "${documentTitle}"
Login to your account to view the document.
`, }); } async sendContactEmail(name: string, email: string, message: string) { // Send to admin await this.mailerService.sendMail({ to: process.env.ADMIN_EMAIL, subject: `New Contact Form Submission from ${name}`, html: `From: ${name}
Email: ${email}
Message:
${message}
`, }); await this.mailerService.sendMail({ to: email, subject: 'Thank you for contacting us', html: `Dear ${name},
We have received your message and will get back to you soon.
Your message:
${message}
Best regards,
IMK Team