title: using smtp gmail to sending mail
body: <p>i would like to know how to send mail from java program. i have written java mailing program nothing wrong in that. but i got unknow SMTP port 465 even i used g mail server port 465.
  i want to know is there any option need to enable in my computer.
  please let  me know what are required, step by step 
  i am using windows 7 and want to use gmail server..</p>
  
  <p>your effort will  be very thankfully. </p>
  
  <p>please let me know any error in following ?</p>
  
  <pre><code>Exception in thread "main" java.lang.RuntimeException: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
    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)
  Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
    nested exception is:
      javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed
      at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1706)
      at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525)
      at javax.mail.Service.connect(Service.java:310)
      at javax.mail.Service.connect(Service.java:169)
      at javax.mail.Service.connect(Service.java:118)
      at javax.mail.Transport.send0(Transport.java:188)
      at javax.mail.Transport.send(Transport.java:118)
      at mail1.SendMailSSL.main(SendMailSSL.java:39)
  Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed
      at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1611)
      at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187)
      at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181)
      at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1035)
      at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:124)
      at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
      at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1139)
      at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
      at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:503)
      at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:234)
      at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1672)
  </code></pre>