Save-Email-Message - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

Save Email Message using wodPop3
VB code
Set Pop3 = New wodPop3Com

Pop3.HostName = "your_pop3_server_address"
Pop3.Login = "your_login"
Pop3.Password = "your_password"

'When the Blocking property is set to True it will cause the execution of the next method
'to be delayed until previous method has finished.
Pop3.Blocking = True

'The Connect method will initiate the connection with server.
Pop3.Connect

'Download all the messages in the mailbox from the server to local files.
'After each message has been received, the Received event will be fired which enables you
'to inspect message the content immediately if you wish.
Pop3.Messages.GetAll

'The Pop3Msgs collection (Pop3.Messages) holds a collection of all messages retreived from the server.
'It can be used to examine the received messages.

'This example will show sender and body of each downloaded message and save the message
'to a local file. You can also acccess all other useful message information via properties
'such as Subject, Body, Attachment, From, Date etc.
Dim i As Integer
For i = 0 To Pop3.Messages.Count - 1
     MsgBox i & ". From: " & Pop3.Messages(i).From
     MsgBox "Body: " & Pop3.Messages(i).Body

     Pop3.Messages(i).Save App.Path & "\" & i & ".txt"
Next i

'Disconnect wodPop3 from the server as we don't need connection any more.
Pop3.Disconnect
C# code
WODPOP3COMLib.wodPop3ComClass Pop3;
private void Form1_Load(object sender, EventArgs e)
{
    Pop3 = new WODPOP3COMLib.wodPop3ComClass();
    Pop3.Hostname = "your_pop3_server_address";
    Pop3.Login = "your_login";
    Pop3.Password = "your_password";

    //When the Blocking property is set to True it will cause the execution of the next method
    //to be delayed until previous method has finished.
    Pop3.Blocking = true;

    //The Connect method will initiate the connection with server.
    Pop3.Connect();

    //Download all the messages in the mailbox from the server to local files.
    //After each message has been received, the Received event will be fired which enables you
    //to inspect message the content immediately if you wish.
    Pop3.Messages.GetAll();

    //The Pop3Msgs collection (Pop3.Messages) holds a collection of all messages retreived from the server.
    //It can be used to examine the received messages.

    //This example will show sender and body of each downloaded message and save the message
    //to a local file. You can also acccess all other useful message information via properties
    //such as Subject, Body, Attachment, From, Date etc.
    short i;
    for (i = 0; i <= Pop3.Messages.Count - 1; i++)
    {
        MessageBox.Show(i + ". From: " + Pop3.Messages[i].From);
        MessageBox.Show("Body: " + Pop3.Messages[i].Body);

        Pop3.Messages[i].Save("C:\\" + i + ".txt");
    }

    //Disconnect wodPop3 from the server as we don't need connection any more.
    Pop3.Disconnect();
}