19 lines
420 B
JavaScript
19 lines
420 B
JavaScript
import postmark from "postmark";
|
|
|
|
const client = new postmark.ServerClient(process.env.POSTMARK_API_KEY);
|
|
|
|
export const sendEmail = async ({to, subject, html, text}) => {
|
|
try {
|
|
await client.sendEmail({
|
|
From: process.env.EMAIL_FROM,
|
|
To: to,
|
|
Subject: subject,
|
|
HtmlBody: html,
|
|
TextBody: text || "",
|
|
MessageStream: "outbound",
|
|
});
|
|
} catch (error) {
|
|
console.error("Email send error:", error);
|
|
}
|
|
};
|