Advice to static react project (send email)

I am new with react/next.js and i m working on a static website to shared host (locaweb). I am using export to build it and i dont know how to make a contact form.

Could i use nodeMailer to do it? It will work on export to a static build?

Hey there,

nice to meet you! :wave:

In theory, this should work.
In practice, I don’t have a good idea how you would keep your mail credentials private.

What’s the problem with running it with the default NextJS setup on a server like Heroku?

1 Like

the client already purchased the host for a year.
Some tutorial i checked adviced to use environment variables to credentials, i will try with it. Thanks for your help miku86!

If you use env variables, we can’t see it in the source code, but if you then export it to a static site, the credentials are visible in the built static code in the client’s browser.

1 Like

i take a look in some solutions using php that dont ask for credentials, it is possible use php just on contact component?

Your php files have to run on a server, too.
So you could also use NextJS server-side.

We are talking about $5 per month, maybe you should talk to your client instead of wasting a lot of time to find a vulnerable or uncommon solution that is probably harder to maintain.