Reading-email-messages-from-Gmail-using-POP3-protocol - 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] **

Reading e-mail messages from Gmail using POP3 protocol
VB code
Dim WithEvents Pop3 As wodPop3Com

Private Sub Form_Load()
    Set Pop3 = New wodPop3Com

    'First we set up the hostname, port, login, password and security options.
    With Pop3
        .HostName = "pop.gmail.com"
        .Security = SecurityImplicit
        .Port = 995
        .Login = "user@gmail.com"
        .Password = "password"
    End With

    'After the information is set, we connect to Gmail's POP3 server.
    Pop3.Connect
End Sub

'Upon successful connection the component will fire the Connected event in which we can tell the component to retrieve all available messages.
Private Sub Pop3_Connected()
    Pop3.Messages.GetAll
End Sub

'The component will retrieve all messages for you and put them in the Messages collection
'from where you can easily access them. It will notify you when messages are available
'by firing the Done event and that is where you probably want to populate a list of messages on your application window
'or do some first-time parsing.
Private Sub Pop3_Done(ByVal ErrorCode As Long, ByVal ErrorText As String, ByVal HeadersOnly As Boolean)
    For i = 0 To Pop3.Messages.Count - 1
        List1.AddItem Pop3.Messages(i).Subject
    Next i
    Pop3.Disconnect
End Sub