sending mail from your computer using java what required?
<p>I have windows 7 system with <em>no</em> smtp servers installed, only java. I want to send mail from my program through gmail. I have written a java program to connect google via smtp, and have enable the telnet option, but I am getting the error below. I tried using port 465 and 587, but no change.</p>

<p><strong>Error:</strong></p>

<pre><code>Exception in thread "main" java.lang.RuntimeException: javax.mail.MessagingException: not connect to SMTP host: smtp.gmail.com, port: 587;
 nested exception is:
 javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed
at mail1.SendMailSSL.main(SendMailSSL.java:44)
</code></pre>

<p><strong>Code:</strong></p>

<pre><code>import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class SendMailSSL {

    public static void main(String[] args) {
        Properties props = new Properties();
        props.put("mail.smtp.host", "smtp.gmail.com");
        props.put("mail.smtp.socketFactory.port", "465");
        props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");

        props.setProperty("mail.transport.protocol", "smtp");
        props.setProperty("mail.smtp.host", "smtp.gmail.com");

        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.port", "587");

       Session session = Session.getDefaultInstance(props,newjavax.mail.Authenticator()
       {
           protected PasswordAuthentication getPasswordAuthentication() {
             return new PasswordAuthentication("mymail@gmail.com","mypassword");                  
           }
       } );

       try {
           Message message = new MimeMessage(session);
           message.setFrom(new InternetAddress("mymail@gmail.com"));
           message.setRecipient(Message.RecipientType.TO, new InternetAddress(
                    "to24n@gmail.com"));
           message.setSubject("Testing Subject");
           message.setText("Dear Mail Crawler,"
                    + "\n\n No spam to my email, please!");
           Transport.send(message);
           System.out.println("Done");

        } catch (MessagingException e) {
           throw new RuntimeException(e);
        }
    }
}
</code></pre>

<p>Can anyone tell me what I need to do to send email from my personal system? Please tell me step-by-step, and include anything like installing software because I must do this for my project. Your answer is very appreciated. Thank you in advance.</p>
