"Could not send your email. Please try again." with MailChannels Pages Plugin

I m trying to send emails from a form in a astro static site I m making but I couldn't find a way to make it work.

I followed the guide https://developers.cloudflare.com/pages/functions/plugins/mailchannels/#spf-support-for-mailchannels

Right now I m not using cloudflare email routing as I m using google workspace, but I suppose it should work anyway, correct?

  • So i created the _middleware.ts file (code on first comment), having "@cloudflare/pages-plugin-mailchannels": "^0.1.2" on the dependencies
  • On the form I added the attribute data-static-form-name="contact"
  • Added includes to my existing spf record so now look like this v=spf1 include:_spf.mx.cloudflare.net include:relay.mailchannels.net include:_spf.google.com -all
  • Generated DKIM Credentials following the guide https://developers.cloudflare.com/pages/functions/plugins/mailchannels/#generate-dkim-credentials
  • Added to environment variables (see image)
  • Added the TXT record mailchannels._domainkey (see image)
  • Added domain lockdown (TXT _mailchannels) with both workers domain and my domain as stated here https://community.cloudflare.com/t/introducing-mailchannels-domain-lockdown/523913/5: v=mc1 cfid=majestico.workers.dev cfid=majestico.it (and see image)
Now when i try to send email from https://majestico.it/contact/ I get the error "Could not send your email. Please try again."

Am I missing something?

Is there a way to debug this problem and get a significant error?

Thanks
image.png
image.png
image.png
image.png
YourSitesName
Open Graph Description
The MailChannels Pages Plugin intercepts all form submissions made which have the data-static-form-name attribute set. Then, it emails these form
Was this page helpful?