SendMailSession
. Mail session encapsulates the process of preparing emails, opening and closing transport connections, and sending emails.MailServer
.EmailException
, it is necessary to wrap methods in try
-catch
block and closing the session in the finally
block.ssl()
flag while creating the server.