Hello,
I am trying to use MailChannels in my pages using the function found on Cloudflare documentation:
let mail_request = {
"method": "POST",
"headers": {
"content-type": "application/json",
},
"body": JSON.stringify({
"personalizations": [
{
"to": [
{"email": "<send to email>", "name": "Recepient"}
],
"dkim_domain": "<my domain>",
"dkim_selector": "mailchannels",
"dkim_private_key": context.env.DKIM_PRIVATE_KEY
}
],
"from": {
"email": "[email protected]<my domain>",
"name": "Me",
},
"subject": output['firstname'] + " " + output['name'],
"content": [{
"type": "text/plain",
"value": _createMessageContent(output),
}],
}),
};
// only send the mail on "POST", to avoid spiders, etc.
if( context.request.method == "POST" ) {
let send_request = new Request("https://api.mailchannels.net/tx/v1/send", mail_request);
const resp = await fetch(send_request);
const respText = await resp.text();
if (resp.status != 200 || resp.status != 202) {
return new Response('Error sending response: ' + respText, { status: 400 });
}
}
But I am getting the following error:
Error sending response: Internal Server Error {"errors":["Failed to send email: 550 5.1.2 [SDNF] Sender Domain Not Found. https://console.mailchannels.net/insights/bounce?auid=cloudflare\u0026sender=rsvp%40<my domain>\u0026txid=1719219f365d9c74"]}
What am I missing ?