I’ve set up an account with a third party email provider and adapted the code as per Wix examples. The code works well in that it returns OK from the ‘fetch’, but no email is received on the other end. Any ideas? Here is the code:
BACK END (sendEmail.jsw):
import {fetch}from ‘wix-fetch’;
export function sendEmail (address, subject, body) {
return fetch(“https://api.sendinblue.com/v2.0?APIKey=h8MwjJKLmfsagh5640YPdfN4yg”, {
method: ‘post’,
body: JSON.stringify({
address, subject, body
})
}).then(function (response) {
if (response.status >= 200 && response.status < 300)
return response.text();
else
throw new Error(response.statusText);
});
}
FRONT END:
import {sendEmail} from ‘backend/sendEmail.jsw’;
$w.onReady(function () {
sendEmail(“address@hotmail.com”, “Test”, “Test”.then (product => {
console.log( "OK: "+product );
})
.catch(error => {
console.log( "ERROR: " +error );
});
});