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 iNet Factory 8.0 Released
04/04/2008 02:24 PM

Updates to Email Factory for .NET and Secure iNet Factory
03/29/2008 04:06 PM

JSCAPE Secure FTP Server 3.9 Preview
03/14/2008 12:19 PM

AnyClient Service and Application Launched
03/12/2008 03:41 PM

JSCAPE Secure FTP Server 3.8 Released
02/12/2008 10:50 AM


Tutorials

Email Validation with Java
04/15/2008 02:04 PM

Sending HTML Based Email Using Java
03/11/2008 02:47 PM

Secure FTP Using Java and FTPS (FTP over SSL)
03/10/2008 04:08 PM

FTP Directory Listing Using Java
03/10/2008 03:57 PM

Sending Email Using Java
03/09/2008 03:43 PM

SSH Using Java
03/09/2008 02:53 PM


Articles

DMZ File Transfer Streaming
03/28/2008 11:57 AM

Phishing looks to FTP to distribute malware
03/13/2008 05:14 PM

Ad Hoc File Transfer Explained
03/13/2008 09:16 AM

Password Policies Made Easy
03/12/2008 03:03 PM


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.