feat: Implement contact message functionality including API endpoints, database storage, and email notifications.

This commit is contained in:
2025-12-09 15:39:20 +03:00
parent 5dc5cd87a8
commit 186bcbf6b8
9 changed files with 138 additions and 0 deletions
+15
View File
@@ -52,6 +52,21 @@ export class EmailService {
await this.sendEmail(to, 'Reset your password', html);
}
async sendContactMessageNotification(data: { name: string; email: string; subject?: string; message: string }) {
const content = `
<p>You have received a new contact message from <strong>${data.name}</strong> (${data.email}).</p>
<p><strong>Subject:</strong> ${data.subject || 'No Subject'}</p>
<hr style="border: 0; border-top: 1px solid #eee; margin: 20px 0;">
<p style="white-space: pre-wrap;">${data.message}</p>
`;
const html = this.getHtmlTemplate('New Contact Message', content);
// Send to the configured notification emails
const recipients = config.email.contactNotificationEmails;
await this.sendEmail(recipients.join(','), `New Contact Message: ${data.subject || 'No Subject'}`, html);
}
private getHtmlTemplate(title: string, content: string): string {
const logoUrl = 'https://res.cloudinary.com/dmxoohiwo/image/upload/v1764315105/logo_fpczsd.png';
const currentYear = new Date().getFullYear();