How to email form submission in react?

Hello everyone !

Still on my first react project (using frontity)
I need a form to send it’s data to an email address and have no idea how to do !

I saw some people use a contact form 7 package, so far i made my forms as react components…

What do you think i should look for?
What is easiest to implement

We have done this with frontity in 2 different ways:

  1. You can use contact form 7 package, and make a form. Then CF7 plugin will take care of the emailing.
  2. You can create a contact form in wordpress using CF7 and not embed it on the view, but make your own form and as part of the action, call the CF7 api to submit your data.

The second approach allows you more control but will also require more work.
Hope this helps.

Greetings

1 Like

option 2 looks very appealing! will look into it, thank you so much for your answer ! at least now i know what to look at

1 Like

Sounds good. Hopefully it works for you. I just took a quick look, and the endpoint you need is:

Method**: POST**
http://www.yourdomain.com/wp-json/contact-form-7/v1/contact-forms/358/feedback

Good luck.

it works !

1 Like

However file attachments are not being sent :frowning:

did everything mentionned here File uploading and attachment | Contact Form 7

not sure if it has something to do with the package itself or if i need to set something up
the wpcf7_uploads folder is created but emails dont have any files attached

Hi @alexis.doroszkiewicz,

Saw that you wanted file uploads. So I added file upload support to the Frontity cf7 package. So now you can use this package and just make a normal form in cf7 with a file upload field.

3 Likes

thank you so much! that was lightning fast!
appreciate your help, this makes my life a lot easier haha

it works!!!

1 Like

Hey Kasper, thank you so much for your work on this. I was trying to retrofit this code for a similar utility on Gravity Forms. Just getting started, but do you have any tips?

@lmaclean I have already made a Gravity Forms package.

1 Like

Hey Kasper, thank you! Yes, I’ve been using it! For one of my projects I need to be able to upload a file, so I’m trying to recreate what you have here for Gravity. Any tips?

Sorry, just starting back to make some headway on this again today. I’ve tried submitting Files with the package as is, and receive an 400 error. Just wanted to make sure I’m not missing something.

That probably took me way too long, but I put together a solution for file uploads for GF!

In fact, just launched this website today using your gravity forms package for frontity! https://neworleanseyespecialists.com/

1 Like