41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
// ...existing code...
|
|
import { brevoService } from '@/common/email/brevoApi';
|
|
import ApiError from '@/common/utils/helper/ApiError';
|
|
|
|
export async function sendAMEmailForHostAssign(emailAddress: string, accountManagerName?: string): Promise<{
|
|
sent: boolean;
|
|
// messageId: string
|
|
}> {
|
|
const subject = "You've Been Assigned a New Host";
|
|
|
|
const displayName = accountManagerName?.trim() || "there";
|
|
|
|
const htmlContent = `
|
|
<p>Hi ${displayName},</p>
|
|
<p>A new host has been assigned to you by the Minglar team.</p>
|
|
<p>You can now manage and support this host through your admin dashboard. Log in to review the host's details, connect with them, and take the next steps as needed.</p>
|
|
<p>Warm regards,<br/>Minglar 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...
|
|
|
|
|