DEV Community

Cover image for How to Send Email Notifications using JAVA? (3 Methods With Code Examples)

How to Send Email Notifications using JAVA? (3 Methods With Code Examples)

Nik L. on January 13, 2024

Some of our articles: Building a Scalable Notification System with gRPC and Microservices How to Send Email Notifications using Python? (With Cod...
Collapse
 
theelitegentleman profile image
Buhake Sindi

Hi Nik,

For your first example, it's very misleading. Any Jakarta EE certified application server can handle JavaMail Session and its resource from the application server itself. All the developer has to do is to @Inject the Session itself. You can set up the mail session at application server level if you're worried about the "cons" of using JavaMail.

The example you provided is running it locally. In enterprises, no companies does that. The beauty of what I just said is that the JavaMail is an Enterprise Java specification that all JakartaEE certified servers can implement, including SpringBoot, and no need for 3rd party dependencies in your code.