2026-05-26 15:48:01 +05:30
|
|
|
import postmark from 'postmark';
|
2026-03-19 13:12:04 +05:30
|
|
|
|
|
|
|
|
const client = new postmark.ServerClient(process.env.POSTMARK_API_KEY);
|
|
|
|
|
|
2026-05-26 15:48:01 +05:30
|
|
|
export const sendEmail = async ({ to, subject, html, text }) => {
|
2026-03-19 13:12:04 +05:30
|
|
|
try {
|
|
|
|
|
await client.sendEmail({
|
|
|
|
|
From: process.env.EMAIL_FROM,
|
|
|
|
|
To: to,
|
|
|
|
|
Subject: subject,
|
|
|
|
|
HtmlBody: html,
|
2026-05-26 15:48:01 +05:30
|
|
|
TextBody: text || '',
|
|
|
|
|
MessageStream: 'outbound',
|
2026-03-19 13:12:04 +05:30
|
|
|
});
|
|
|
|
|
} catch (error) {
|
2026-05-26 15:48:01 +05:30
|
|
|
console.error('Email send error:', error);
|
2026-03-19 13:12:04 +05:30
|
|
|
}
|
|
|
|
|
};
|