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.

2 Likes

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

it works!!!

1 Like