48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { brevoService } from "@/common/email/brevoApi";
|
||
import ApiError from "@/common/utils/helper/ApiError";
|
||
|
||
export async function sendInvitationEmailForMinglarAdmin(
|
||
emailAddress: string,
|
||
link: string
|
||
): Promise<{
|
||
sent: boolean;
|
||
// messageId: string
|
||
}> {
|
||
|
||
const subject = "Minglar Admin: Your Team Invitation";
|
||
|
||
const htmlContent = `
|
||
<p>Hi there,</p>
|
||
<p>We're excited to invite you to join the <strong>Minglar Admin Team</strong>!<br/>
|
||
Please use the link below to set up your account and get started.</p>
|
||
|
||
<p><strong>Access Your Invitation:</strong><br/>
|
||
<a href="${link}">${link}</a></p>
|
||
|
||
<p>If you have any questions or need assistance, feel free to reach out — we’re here to help.<br/>
|
||
We look forward to having you on board!</p>
|
||
|
||
<p>Welcome aboard!<br/>
|
||
<strong>The Minglar Admin Team</strong></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.");
|
||
}
|
||
}
|