Solved code to parse POP3 mails

Posted on 2009-12-18
Last Modified: 2013-11-25
Hello All,
I have a windows app which streams through emails from a givena mailbox and saves the data into the DB.

We are now in the process of changing the mail setup, I mean from Pop3 to Exchange mailbox.

I dont know whether this change will have an impact on the attached code, please can someone have a look and advice?

Any help/advise/suggestion is greatly appreciated.

Thanks in advance.

Dim POPClient As Pop3.Pop3MimeClient

        Dim OrderID As Integer

        Dim MailServer As String = My.Settings("MailServer")

        Dim EmailBody As String

        Dim Testing As Boolean = True



            Dim Username = ""

            Dim Password = "testing"

            POPClient = New Pop3.Pop3MimeClient(MailServer, 110, False, Username, Password)

            'Connect to the POP server


            Dim NumberOfEmails As Integer

            Dim MailBoxSize As Integer

            POPClient.GetMailboxStats(NumberOfEmails, MailBoxSize)

            '*** Process orders ****

            For i As Integer = 1 To NumberOfEmails

                Dim DSO As New DropShipOrderClass

                Dim m As New Pop3.RxMailMessage

                'Get the next email

                POPClient.GetEmail(i, m)

                'Emails from test

                If InStr(m.From.Address, "") Then

                    'Email should only be processed if it's an order

                    If InStr(m.Subject, "Order") > 0 Then

                        DSO = CreateOrderFromEmail(m.Bod)

                        If Not DSO Is Nothing Then

                            OrderID = AddOrder(DSO, m.Body)

                            If OrderID > 0 Then

                                If Not Testing Then


                                End If

                            End If

                        end If

                    End If

                End IF


Open in new window

Question by:charlie324
    LVL 10

    Accepted Solution

    LVL 6

    Author Comment


    thanks for your input.

    i am unable to understand how does it all working ...

    thanks for the help

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now