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

iTunes Gift Card Offer

For a limited time get a $50.00 iTunes gift card free with qualifying purchase.

Click for details.


News

JSCAPE Secure FTP Server 7.0 Released
08/20/2010 03:31 AM

JSCAPE launches Employee Giving Program
07/03/2010 08:26 AM

SSH Factory 3.6 Released
07/03/2010 06:22 AM

Secure iNet Factory 8.5 Released
07/03/2010 06:07 AM

Secure FTP Factory 8.5 Released
07/03/2010 06:03 AM

Secure FTP Applet 6.2 Released
06/10/2010 02:23 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

Open up corporate data to your partners
08/03/2010 10:01 PM

Access vital corporate documents on the go
07/01/2010 02:15 PM

SFTP and Encryption
05/17/2010 09:52 PM

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

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.