Build: Update server-dist artifacts for v0.1.4
This commit is contained in:
@@ -97,28 +97,33 @@ export async function sendEmail(params) {
|
||||
console.warn("Resend API key not configured. Skipping email send.");
|
||||
return { success: false };
|
||||
}
|
||||
const payload = {
|
||||
from: params.from || DEFAULT_FROM,
|
||||
to: Array.isArray(params.to) ? params.to : [params.to],
|
||||
subject: params.subject,
|
||||
text: params.text,
|
||||
html: params.html,
|
||||
cc: params.cc ? (Array.isArray(params.cc) ? params.cc : [params.cc]) : undefined,
|
||||
bcc: params.bcc ? (Array.isArray(params.bcc) ? params.bcc : [params.bcc]) : undefined,
|
||||
reply_to: params.replyTo ? (Array.isArray(params.replyTo) ? params.replyTo : [params.replyTo]) : undefined,
|
||||
attachments: params.attachments,
|
||||
};
|
||||
console.log(`Sending email via Resend: to=${JSON.stringify(payload.to)}, subject="${params.subject}"`);
|
||||
const response = await fetch("https://api.resend.com/emails", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Authorization": `Bearer ${RESEND_API_KEY}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
from: params.from || DEFAULT_FROM,
|
||||
to: Array.isArray(params.to) ? params.to : [params.to],
|
||||
subject: params.subject,
|
||||
text: params.text,
|
||||
html: params.html,
|
||||
cc: params.cc ? (Array.isArray(params.cc) ? params.cc : [params.cc]) : undefined,
|
||||
bcc: params.bcc ? (Array.isArray(params.bcc) ? params.bcc : [params.bcc]) : undefined,
|
||||
attachments: params.attachments,
|
||||
}),
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
if (!response.ok) {
|
||||
const body = await response.text().catch(() => "");
|
||||
console.error("Resend send error:", response.status, body);
|
||||
return { success: false };
|
||||
}
|
||||
const responseData = await response.json().catch(() => ({}));
|
||||
console.log("Resend email sent successfully:", responseData);
|
||||
return { success: true };
|
||||
}
|
||||
export async function sendEmailWithAGB(params) {
|
||||
|
Reference in New Issue
Block a user