This is a mirror of official site: http://jasper-net.blogspot.com/

Using POP3 with C# to download and parse your mail.

| Tuesday, June 28, 2011
Introduction

This article explains a simple way to add mail support in your application. Just use the classes:

POP3class methods:

    string DoConnect(String pop3host,int port, String user, String pwd)
    string GetStat()
    string GetList()
    string GetList(int num)
    string Retr(int num)
    string Dele(int num)
    string Rset()
    string Quit()
    string GetTop(int num)
    string GetTop(int num_mess, int num_lines)
    string GetUidl()
    string GetUidl(int num)
    string GetNoop()

MessageClass methods:

    string GetFrom(string messTop)
    string GetDate(string messTop)
    string GetMessID(string messTop)
    string GetTo(string messTop)
    string GetSubject(string messTop)
    string GetBody(string AllMessage)

Using the code

The following sample illustrates how to use the classes:


POP3class pop3;
pop3 = new POP3class();
pop3.DoConnect("your.mail.server",110,"username","password");
pop3.GetStat();
// and if we have mail:

MessageClass msg;
msg = new MessageClass();
string sMessageTop = msg.GetTop(1);
//OK, message is well, lets download it.


Read more: Codeproject
QR: karavaev_denis.aspx

Posted via email from Jasper-net

0 comments: