Reputation: 11
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
Reputation: 429
Firstly, I think you need to know how the email workflow works.
I'll try to summarise:
You need an SMTP server to send emails (your hosting provider can probably supply you with one).
Once you've set it up, you can email whoever you want.
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