Pop .NET Component - POP .NET Component, pop c#, pop vb, pop class
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


 

Pop .NET Component

The Pop .NET Component provides a simple interface for communicating with a POP (Post Office Protocol v3) server.

download email factory for .netpurchase email factory for .net

Features

  • 100% managed C# - A highly scalable solution with no dependencies on 3rd party libraries.
  • Email address helper classes for parsing email addresses.
  • Royalty-Free Distribution - No runtime fees!
  • Easily retrieve attachments from email messages.
  • Serialization support allows you to easily store email messages to disk or a database
  • International support for multiple character sets.
  • Thread safe - Critical code blocks are synchronized for use by multiple threads.
  • Event Model - Multiple events for capturing POP activity
  • Integrated Help - Automatic integration of Help 2.0 documentation for Visual Studio .NET


Code Example

The following C Sharp example demonstrates retrieving messages from a POP3 server using the Pop .NET component.

/*
 * PopExample.cs
 *
 * Copyright (c) 1999-2005 JSCAPE, LLC
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JSCAPE ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JSCAPE.
 */
using System;
using System.Collections;
using System.IO;
using System.Text;
using System.Threading;
using Jscape.Email;

namespace PopExample {

   class PopExample {

      public Pop myPop = null;
      // set default attachment folder
      public string attDir = "./messages/attachments/";

      public PopExample(string hostname, string username, string password){
         myPop = new Pop(hostname, username, password);
         // turn on debug mode
         myPop.Debug = true;
         // don't delete messages from server
         myPop.DeleteMessages = false;

         // Subscribe to events
         myPop.ConnectedEvent += new Pop.ConnectedEventHandler(OnConnected);
         myPop.DisconnectedEvent += new Pop.DisconnectedEventHandler(OnDisconnected);
         myPop.DataReceivedEvent += new Pop.DataReceivedEventHandler(OnDataReceived);
         myPop.CommandSentEvent += new Pop.CommandSentEventHandler(OnCommandSent);
         myPop.MessageRetrievedEvent += new Pop.MessageRetrievedEventHandler(OnMessageRetrieved);

         // test current dir structure
         if (!Directory.Exists(attDir)) {
            Directory.CreateDirectory(attDir);
         }

         // connect to Pop server
         myPop.Connect();
         int mc = 0;
         // retrieve all email messages
         IEnumerator e = myPop.GetMessages();
         while(e.MoveNext()) {
            ++mc;
            int ac = 0;
            EmailMessage message = (EmailMessage)e.Current;
            // get attachments for each email, if any
            IEnumerator ea = message.GetAttachments();
            while(ea.MoveNext()) {
               ++ac;
               Attachment a = (Attachment)ea.Current;
               // get name of attached file, if any
               string filename = a.GetFilename();
               if (filename.Length == 0) {
                  // build temporary filename
                  filename = "att" + mc + "_" + ac + ".txt";
               }
               // get data for attached file
               byte[] data = a.GetFileData();
               // save the attachment
               FileStream fs = new FileStream(attDir + filename, FileMode.Create, FileAccess.Write);
               BinaryWriter w = new BinaryWriter(fs);
               w.Write(data, 0, data.Length);
               fs.Close();
            }
         }

         // your server may require a slight delay in order to respond.
         Thread.Sleep(100);
         // disconnect from server
         myPop.Disconnect();
      }

      [STAThread]
      static void Main(string[] args) {
         string hostname = "mail.ourserver.com";
         string username = "username@ourserver.com";
         string password = "password";

         PopExample popexample = new PopExample(hostname, username, password);
      }

      public void OnConnected(object sender, PopConnectedEventArgs e) {
         Console.WriteLine("Connected to {0}", e.Host);
      }
      public void OnDisconnected(object sender, PopDisconnectedEventArgs e) {
         if (myPop.IsConnected()) {
            myPop.Disconnect();
         }
         Console.WriteLine("Disconnected.");
      }
      public void OnDataReceived(object sender, PopDataReceivedEventArgs e) {
         Console.WriteLine("Response: "+e.Response);
      }
      public void OnCommandSent(object sender, PopCommandSentEventArgs e) {
         Console.WriteLine("Command: "+e.Command);
      }
      public void OnMessageRetrieved(object sender, PopMessageRetrievedEventArgs e) {
         // Uncomment the following line to display each message subject
         //Console.WriteLine("Message subject= "+e.Message.Subject);
      }

   }
}

download email factory for .netpurchase email factory for .net