Soumitra Agrawal
Soumitra Agrawal

Reputation: 11

How can I add sending emails in my webapp?

I built a webapp using spring boot and I want to add send emails feature, which allows users to send emails to their contacts using their own email address. How can I setup this feature?

I think using OAuth 2.0 to get access tokens and refresh tokens will it be useful

Upvotes: -3

Views: 62

Answers (1)

Juranir Santos
Juranir Santos

Reputation: 429

Firstly, I think you need to know how the email workflow works.

I'll try to summarise:

  1. You need an SMTP server to send emails (your hosting provider can probably supply you with one).

  2. Once you've set it up, you can email whoever you want.

  3. The tricky part here is when you talk about ‘using your own email address’, because to send an email as another user, to reduce the risk of being marked as spam (the biggest problem in my opinion) you have to make some settings that I don't think are necessary.

One thing you can do is send an email from your send domain but set the name in the from as the user's email. GitHub notifications use this approach, for example (UserName [email protected]).

Assuming that's clear, basically, you need to set up some mail library in your project and have fun

Upvotes: -2

Related Questions