ANPOP Developers Center > Using ANPOP in .NET Framework SDK
Important notice:* This product has integrated to EAGetMail POP3 Component, Please use EAGetMail POP3 Component instead of ANPOP POP3 Component.
EAGetMail Related Links:
Retrieve Email and Parse Email in Visual Basic
Retrieve Email and Parse Email in Visual C++
Retrieve Email and Parse Email in Delphi
Retrieve Email and Parse Email in VB.NET
Retrieve Email and Parse Email in C#
Retrieve Email and Parse Email in Managed C++
You should download the anpop installer and install it on your machine at first. If you want to distribute or deploy anpop without anpop installer, please click here to learn more.
Import ANPOP to .NET assembly
This tutorial introduces how to use ANPOP in .NET Framework SDK without Visual Studio.NET. If you use Visual Studio.NET as your development tool, please refer to the corresponding tutorials.
In "DOTNET Assembly" directory of ANPOP installation directory, there is a file "ANPOPLib.dll", it is the run-time file of ANPOP in dotnet common language assembly. You can also generate "ANPOPLib.dll" by "tlbImp" tool in .NET Framework SDK.
[run this command under dos prompt] tlbimp "C:\Program Files\AdminSystem.NET\ANPOP\ANPOP.dll" /namespace:ANPOPLib /out:ANPOPLib.dll
Simple project
Create a file named "test.cs" with notepad, and input the following code:
using System;
using ANPOPLib;
namespace CheckEmail
{
class CheckEmail
{
public static void Main( string[] args )
{
string server = "", user = "", password = "";
Console.WriteLine( "Welcome to ANPOP CSharp Sample");
Console.WriteLine( "Please input pop3 server");
server = Console.ReadLine().Trim();
Console.WriteLine( "Please input user name");
user = Console.ReadLine().Trim();
Console.WriteLine( "Please input password");
password = Console.ReadLine().Trim();
Console.WriteLine( "Start to connect {0} ...", server );
try
{
POPMAINClass oPop3 = new POPMAINClass();
if( oPop3.Connect( server, user, password ) != 0 )
throw new Exception( "Error with Connect method" );
int nCount = oPop3.GetTotalOfMails();
if( nCount == -1 )
throw new Exception( "Error with GetTotalOfMails method" );
Console.WriteLine( "Total {0} email(s) on server", nCount );
}
catch( Exception e )
{
Console.WriteLine( e.Message );
}
Console.WriteLine( "Quit" );
}
}
}
Compile this project
Copy "ANPOPLib.dll" to the same directory as "test.cs"
[run under DOS prompt] set CompilerPath=%WINDIR%\Microsoft.NET\Framework\v1.0.3705 %CompilerPath%\csc /reference:ANPOPLib.dll /out:CheckEmail.exe test.cs
Note: the compiler of Visual Basic.NET is vbc and the compiler of JScript.NET is jsc.
Now, try to run CheckEmail.exe.
Free Email Support
Not enough? Please contact our technical support team.
Support@EmailArchitect.NET
VIP@EmailArchitect.NET(Registered
User)
Remarks
We usually reply emails in 24hours. The reason for getting no response is likely
that your smtp server bounced our reply. In this case, please try to use another
email address to contact us. Your Hotmail or Yahoo email account is recommended.
|