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.
Mail client API
Java example
Here's a sample of the Java client creating a default JavaMail session:
private Properties mailServerProperties;
private Session getMailSession;
private MimeMessage generateMailMessage;
public void completeClientSend() throws AddressException, 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");
...