Skip to content

Commit ff32ff9

Browse files
committed
add more logs
1 parent 1b4a2a8 commit ff32ff9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

apps/smtp-server/src/server.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,24 @@ async function sendEmailToUnsend(emailData: any, apiKey: string) {
1717
const url = new URL(apiEndpoint, UNSEND_BASE_URL); // Combine base URL with endpoint
1818
console.log("Sending email to Unsend API at:", url.href); // Debug statement
1919

20+
const emailDataText = JSON.stringify(emailData);
21+
2022
const response = await fetch(url.href, {
2123
method: "POST",
2224
headers: {
2325
Authorization: `Bearer ${apiKey}`,
2426
"Content-Type": "application/json",
2527
},
26-
body: JSON.stringify(emailData),
28+
body: emailDataText,
2729
});
2830

2931
if (!response.ok) {
3032
const errorData = await response.text();
31-
console.error("Unsend API error response:", errorData);
33+
console.error(
34+
"Unsend API error response: error:",
35+
errorData,
36+
`\nemail data: ${emailDataText}`
37+
);
3238
throw new Error(
3339
`Failed to send email: ${errorData || "Unknown error from server"}`
3440
);

0 commit comments

Comments
 (0)