NEWS   PRODUCTS   DOWNLOADS   SUPPORT   CONTACT   DEVELOPERS    COMMUNITY

ANPOP POP3 COMPONENT BUILD 5.6

Platform: Windows95/98/2000/NT/ME/XP/2003

Buy   Download   Features   Tutorials

ANPOP V5.6 Release
January, 2005

ANPOP is one of the high performance and comprehensive POP3 COM Object. With ANPOP, your ASP, VB, VC++, C#, .NET framework or other COM environment applications can retrieve email from mail server based on POP3 protocol and parse email based on MIME.

ANPOP Component supports all operations of POP3 protocol. It incorporates POPMSG function that parses email structure, abstracting specified stuffs from Message Body, such as Recipients, Subject, Body, Attachment and more. It also provides MAILSTORE object to store email in local disk easily. Developer can easily use it to develop email client tool and web application.

Quick Tutorial - ASP/VB/VC++

With only some simple scripts your applications will be enabled to retreive email from POP3 server and parse email based on MIME.

ASP Sample

This sample demonstrates how to receive pop3 email in ASP

Set POP3 =Server.CreateObject("ANPOP.POPMAIN") 'create pop3 main object
Set POP3_MSG = Server.CreateObject("ANPOP.POPMSG") 'create pop3 msg object

Dim lRet, lCount
lRet = POP3.Connect( "pop3.email.com", "asp", "asp.net" ) 'connecting pop3 server
If lRet = 0 Then
  lCount = POP3.GetTotalOfMails()
  For i = 1 To lCount
    POP3_MSG.RawContent = POP3.Retrieve( i )
    'Saving email to disk
    POP3_MSG.ExportFile "c:\pop3" & i & ".eml"
    'Deleting email from pop3 server
    POP3.Delete i
  Next
End If
'Cancel deletion operations
'POP3.Reset
POP3.Close

Visual Basic Sample ( Retrieve Email )

This sample demonstrates how to retrieve pop3 email in Visual Basic

Dim POP3 As Object
Dim POP3_MSG As Object

Set POP3 = Server.CreateObject("ANPOP.POPMAIN") 'create pop3 main object
Set POP3_MSG = Server.CreateObject("ANPOP.POPMSG") 'create pop3 msg object
						
Dim lRet As Long
Dim lCount As Long

lRet = POP3.Connect( "pop3.email.com", "asp", "asp.net" ) 'connecting pop3 server
If lRet = 0 Then
  lCount = POP3.GetTotalOfMails()
  For i = 1 To lCount
    POP3_MSG.RawContent = POP3.Retrieve( i )
    'Saving email to disk
    POP3_MSG.ExportFile "c:\pop3" & i & ".eml"
    'Deleting email from pop3 server
    POP3.Delete i
  Next
End If
'Cancel deletion operations
'POP3.Reset

POP3.Close

Visual Basic Sample ( Parse Email )

'This sample demonstrates how to parse email in Visual Basic

Dim POP3_MSG As Object
Set POP3_MSG = CreateObject("ANPOP.POPMSG") 'create com object

Dim lCount As Long
POP3_MSG.ImportFile "c:\pop3_test.eml" 'import email to this component
MsgBox "BodyText: " & POP3_MSG.GetBodyText() 'get email body text
MsgBox "Date: " & POP3_MSG.GetDate() 'get email's date
MsgBox "From: " & POP3_MSG.GetFromAddress() 'get sender's email address
MsgBox "ReplyTo: " & POP3_MSG.GetReplyTo() 'get email address to reply
MsgBox "Subject: " & POP3_MSG.GetSubject() 'get email's subject
MsgBox "Size: " & POP3_MSG.GetMessageSize() 'get email's size

'get all normal recipients' email address
lCount = POP3_MSG.GetRecipientCount()
For i = 1 To lCount
  MsgBox "To: " & POP3_MSG.GetRecipientAddr(i)
Next

'get all CC recipients' email address
lCount = POP3_MSG.GetCCCount()
For i = 1 To lCount
  MsgBox "CC: " & POP3_MSG.GetCCAddr(i)
Next

'save all attachments of this email to c:\
lCount = POP3_MSG.GetAttachmentCount()
For i = 1 To lCount
  POP3_MSG.SaveAttachment "c:\", i
Next

Visual C++ Sample

This sample demonstrates how to retrieve pop3 email in Visual C++

#include <comdef.h>
#include "ANPOP.h"
#include "ANPOP_i.c"
						
//create pop3 connection object and messge object
IPOPMAIN* pConnection = NULL;
IPOPMSG* pMessage = NULL;

HRESULT hr = ::CoInitialize( NULL );
hr = ::CoCreateInstance( CLSID_POPMAIN,
		NULL,
		CLSCTX_ALL,
		IID_IPOPMAIN,
		(LPVOID*)&pConnection );
						
_ASSERT( SUCCEEDED( hr ) && pConnection != NULL );

hr = ::CoCreateInstance( CLSID_POPMSG,
NULL, CLSCTX_ALL, IID_IPOPMSG, (LPVOID*)&pMessage ); _ASSERT( SUCCEEDED( hr ) && pMessage != NULL ); //Connect to pop3 email server long lRet = 1; pConnection->Connect( _bstr_t("pop3.control.com"), _bstr_t("Jack"), _bstr_t("ja1234"), &lRet ); if( lRet == 0 ) { //Get total count of emails existing on POP3 server. pConnection->GetTotalOfMails( &lRet ); long lLen = lRet; for( int i = 0 ; i < lLen; i++ ) { //Retrieve each email and save it to disk BSTR bstrOut = NULL; pConnection->Retrieve( i+1, &bstrOut ); pMessage->put_RawContent( bstrOut ); TCHAR szBuf[256]; ::wsprintf( szBuf, "%s\\%d.eml", "c:\\", i+1 ); pMessage->ExportFile( _bstr_t( szBuf ), &lRet ); ::SysFreeString( bstrOut ); bstrOut = NULL; } } pConnection->Close(); pConnection->Release(); pConnection = NULL; pMessage->Release(); pMessage = NULL; ::CoUninitialize();

Learn more information about ANPOP COMOPONENT

ANPOP documentation/samples

Email: support@adminsystem.net


2001-2005 © Copyright AdminSystem Software Limited. All rights reserved.   About us   Links
1 2 10 3 4 5 6 7 11 8 1