Refer these
https://www.baeldung.com/spring-email
https://mailtrap.io/blog/spring-send-email/
You need to have credentials or API keys based on mail provider. For example, if you want to use Google mail for sending mails, you need an [App password] (https://medium.com/rails-to-rescue/how-to-set-up-smtp-credentials-with-gmail-for-your-app-send-email-cf236d11087d) which is different from account password