@@ -0,0 +1,2312 @@
+package com.rawsanj.mail;%0A%0Aimport java.util.Properties;%0A%0Aimport javax.mail.Message;%0Aimport javax.mail.MessagingException;%0Aimport javax.mail.PasswordAuthentication;%0Aimport javax.mail.Session;%0Aimport javax.mail.Transport;%0Aimport javax.mail.internet.InternetAddress;%0Aimport javax.mail.internet.MimeMessage;%0A%0Apublic class SendZohoMailTLS %7B%0A   public static void main(String%5B%5D args) %7B%0A      // Recipient's email ID needs to be mentioned.%0A      String to = %22sendToAddress@example.com%22;//change accordingly%0A%0A      // Sender's email ID needs to be mentioned%0A      String from = %22sendFromAddress@zoho.com%22;//change accordingly%0A      %0A      final String username = %22sendFromAddress@zoho.com%22;//change accordingly%0A      final String password = %22*******%22;//change accordingly%0A%0A      // Zoho's SMTP server%0A      String host = %22smtp.zoho.com%22;%0A%0A      Properties props = new Properties();%0A      props.put(%22mail.smtp.auth%22, %22true%22);%0A      props.put(%22mail.smtp.starttls.enable%22, %22true%22);%0A      props.put(%22mail.smtp.host%22, host);%0A      props.put(%22mail.smtp.port%22, %22587%22);%0A      props.put(%22mail.smtp.ssl.trust%22, host);%0A%0A      // Get the Session object.%0A      Session session = Session.getInstance(props,%0A      new javax.mail.Authenticator() %7B%0A         protected PasswordAuthentication getPasswordAuthentication() %7B%0A            return new PasswordAuthentication(username, password);%0A         %7D%0A      %7D);%0A%0A      try %7B%0A    %09  System.out.println(%22Indisde rty%22);%0A         // Create a default MimeMessage object.%0A         Message message = new MimeMessage(session);%0A%0A         // Set From: header field of the header.%0A         message.setFrom(new InternetAddress(from));%0A%0A         // Set To: header field of the header.%0A         message.setRecipients(Message.RecipientType.TO,%0A         InternetAddress.parse(to));%0A%0A         // Set Subject: header field%0A         message.setSubject(%22Zoho - Email Test%22);%0A%0A         // Now set the actual message%0A         message.setText(%22Hello, this is sample email to check/send %22%0A            + %22email using JavaMailAPI from Zoho%22);%0A%0A         // Send message%0A         Transport.send(message);%0A%0A         System.out.println(%22Sent message successfully.... from Zoho%22);%0A%0A      %7D catch (MessagingException e) %7B%0A    %09  System.out.println(e.getMessage());%0A            throw new RuntimeException(e);%0A      %7D%0A   %7D%0A%7D

Send Java Mail from Zoho