mailchannels and static forms
I am using mailchannels plugin as detailed in this documentation https://developers.cloudflare.com/pages/functions/plugins/mailchannels/
Right now, it works but all the information from my contact form is in the body of the email and the subject of the email is set to default as "New contact form submission" (see pic) since I am using the attribute data-static-form-name="contact" per documentation
I want to set the reply to email set to the senders email address. Was reading through mailchannels api from here and it seems like there is a reply to in the personalizations https://api.mailchannels.net/tx/v1/documentation
I saw this static forms pages plugin, which uses the same attribute as mailchannels https://developers.cloudflare.com/pages/functions/plugins/static-forms/
Would that be the route to take if I want to capture the information in my contact form and set it to information in my _middleware.ts from the mailchannels plug in? Thank you!
Cloudflare Docs
MailChannels · Cloudflare Pages docs
The MailChannels Pages Plugin intercepts all form submissions made which have the data-static-form-name attribute set. Then, it emails these form …
Cloudflare Docs
Static Forms · Cloudflare Pages docs
The Static Forms Pages Plugin intercepts all form submissions made which have the data-static-form-name attribute set. This allows you to take action …
3 Replies
hello, I m web dev. how can I help you?
Hello. Quick question actually. As you can see in the picture I sent, the body of the email includes all the information from my form. I just need the message from my form to be in the body of my email, not the name, email, category. I have the name and category set to my subject field and the email to my reply to. How can I edit my typescript to include just the message, not all of the fields? I looked into the mailchannels API and I see "content" so I tried to put the message in there but didn't work. Here's a screenshot of my current _middleware.ts
Would probably be easier to see if I just paste the code here