Mail client API
Java mail has the API to generate a client to send SMTP messages. In this paragraph, we will see how to write the Java client.
Java example
Here's a sample of the Java client creating a default JavaMail session:
privateProperties mailServerProperties; privateSession getMailSession; privateMimeMessage generateMailMessage; publicvoidcompleteClientSend()throwsAddressException,MessagingException{ // Step1 logger.info("n 1st ===> setup Mail Server Properties.."); mailServerProperties=System.getProperties(); mailServerProperties.put("mail.smtp.port","587"); mailServerProperties.put("mail.smtp.auth","true"); mailServerProperties.put("mail.smtp.starttls.enable","true"); logger.info("Mail Server Properties have been setup successfully.."); // Step2 logger.info("nn 2nd ===> get Mail Session.."); getMailSession=Session.getDefaultInstance(mailServerProperties,null); generateMailMessage=newMimeMessage...