Java pop, email SSL, POP SSL, Gmail SSL
Home Search Knowledge Base Support

Support

Click here for access to live sales support.

For technical support please submit a ticket to the Help Desk.

 

Java and .NET Help

iPod shuffle offer

For a limited time get the newly re-designed iPod shuffle free with qualifying purchase.

Click for details.


News

Secure FTP Factory 8.4 Released
03/11/2010 09:55 AM

Secure iNet Factory 8.4 Released
03/11/2010 09:52 AM

JSCAPE Secure FTP Server 6.4 Released
01/18/2010 03:58 PM

JSCAPE Secure FTP Server 6.3 Released
12/14/2009 05:45 PM

Secure iNet Factory 8.3.1 Released
12/04/2009 04:26 PM

SSH Factory 3.5 Released
11/10/2009 01:46 PM

more...


Tutorials

Enabling Phone Authentication
04/08/2009 11:24 AM

Detecting and Handling Brute Force Password Attacks
01/29/2009 09:44 AM

Creating a Domain
12/15/2008 11:33 AM

Public key authentication with SFTP
10/02/2008 07:59 AM

Formatting MimeMessages using .NET
09/14/2008 04:31 PM

Communicating with an IMAP4 server in .NET
09/14/2008 03:54 PM

more...


Articles

Streamlining web uploads with ZIP archives
12/14/2009 10:11 AM

Using regular expressions in complex trigger conditions
09/08/2009 07:42 AM

Using custom forms to automate business processes
07/03/2009 08:51 AM

Public key authentication with SFTP
10/02/2008 07:59 AM

Best Practices for Configuring Your FTP Server
06/03/2008 04:47 PM

What is the difference between passive and active FTP?
05/20/2008 09:27 AM

more...


Feedback

Request a feature or component

Request a Java or .NET component


 

Retrieving email securely from Gmail using POP SSL

Overview

The free Google email service Gmail offers over 2GB of storage space prompting many people to signup for accounts. In order to access your account you must however use a secure POP connection using SSL.

The purpose of this article is to demonstrate how to connect to a Gmail account using the Java com.jscape.inet.popssl.PopSsl class found in Secure iNet Factory.

The procedures in this article may also apply to other POP servers which provide secure SSL/TLS access.

For a tutorial on sending email using Gmail see Sending email securely using Gmail and SMTP SSL.

Prerequisites

  1. A Gmail account. As of this writing this service is still in beta. If you do not have an account you must get invited to open an account from someone who already has one.
  2. JDK 1.2.2 or above and Secure iNet Factory

Note

If using a JDK prior to JDK 1.4 then you must download and install the JSSE (Java Secure Socket Extensions). Instructions for doing this are provided in the Secure iNet Factory User Guide.

Example

01 import com.jscape.inet.email.*;
02 import com.jscape.inet.popssl.*;
03 
04 
05 public class PopSslTest {
06   
07   public static void main(String[] args) {
08     String hostname = "pop.gmail.com";
09     String username = "user@gmail.com";
10     String password = "password";
11     try {
12       // create new PopSsl instance
13       PopSsl ssl = new PopSsl(hostname,995,username,password);
14       ssl.setDebug(true);
15       
16       // establish SSL/TLS connection 
17       ssl.connect();
18       
19       // get message count
20       int count = ssl.getMessageCount();
21       
22       // get each message and print subject
23       for(int i = 1; i <= count; ++i) {
24         EmailMessage msg = ssl.getMessage(i);
25         System.out.println("Subject: " + msg.getSubject());        
26       }
27       
28       // disconnect
29       ssl.disconnect();      
30     catch(Exception e) {
31       e.printStackTrace();
32     }
33   }
34 
35 }
  1. Lines 1-3. Import necessary classes.
  2. Lines 8-10. Define hostname, username and password variables.
  3. Line 13. Create new PopSsl instance.
  4. Line 17. Establish secure connection.
  5. Line 20. Get message count.
  6. Lines 23-26. Get each message and print Subject header to console.
  7. Line 29. Disconnect

Summary

In this article you learned how to securely retrieve email from a Gmail server using the secure POP classes provided in Secure iNet Factory.

The procedures in this article may also apply to other POP servers which provide secure SSL/TLS access.