38 lines
953 B
TypeScript
38 lines
953 B
TypeScript
// ...existing code...
|
||
import { brevoService } from '@/common/email/brevoApi';
|
||
import ApiError from '@/common/utils/helper/ApiError';
|
||
|
||
export async function sendAMEmailForHostAssign(emailAddress: string): Promise<{
|
||
sent: boolean;
|
||
// messageId: string
|
||
}> {
|
||
const subject = 'Minglar Admin: Host Assignment Notification';
|
||
|
||
const htmlContent = `
|
||
<p>Hi,</p>
|
||
|
||
<p>You’ve been assigned the <strong>Host</strong> role by Minglar Admin.</p>
|
||
|
||
<p>Best regards,<br/>Minglar Admin Team</p>
|
||
`;
|
||
|
||
try {
|
||
const result = await brevoService.sendEmail({
|
||
recipients: [{ email: emailAddress }],
|
||
subject,
|
||
htmlContent,
|
||
});
|
||
|
||
console.log('📧 Email sent successfully:', result);
|
||
|
||
return {
|
||
sent: true,
|
||
// messageId: result.messageId
|
||
};
|
||
} catch (err) {
|
||
console.error('Brevo email send failed:', err);
|
||
throw new ApiError(500, 'Failed to send invitation via email.');
|
||
}
|
||
}
|
||
// ...existing code...
|