Rui Pedro
Rui Pedro

Reputation: 97

React Form send email

I am building a form in react and I wanted to send it to my email when the user clicked the submit button.

I was looking at Microsoft Graph API for sending the email (https://learn.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=javascript), but checking it, seems that it needs a temporary token, so I can't use it as I would need to be changing the token every hour or so.

So, I'm basicaly trying to find an API like the Gmail but for office 365 accounts (https://developers.google.com/gmail/api/guides/sending), as we can create a gcp project and use the keys that it generates for us, instead of using a token like the MS Graph API

Generaly I would use a route in my API, but this site is static, so I do not have any API (neither serverlets, cloud functions or other stuff like it).

Is there any away to send an email through a Microsoft API from my web client in react, using only a token specific to the domain? Or is there a better away to acomplish this same result?

Upvotes: 0

Views: 1782

Answers (2)

Badmaash
Badmaash

Reputation: 795

I highly recommend using https://formsubmit.co/. It's free and I personally use it in many projects. Works flawlessly with many features like email templating, captcha, reply_to, etc.

No backend knowledge is required. Can set it up in like 1 minute.

Upvotes: 1

Liel Fridman
Liel Fridman

Reputation: 1198

One option would be to authenticate on behalf of the user. You can also have a small proxy API, dedicated for the purpose of allowing the users to send an email.

Upvotes: 0

Related Questions