File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments