• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 649
  • Last Modified:

ASP.net code to parse POP3 mails

Hello All,
I have a VB.net 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.

Regards
Charlie
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 = "testing@xyz.com"
            Dim Password = "testing"

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

            'Connect to the POP server
            POPClient.Connect()

            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, "testing@xyz.com") 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
                                    POPClient.DeleteEmail(i)
                                End If
                            End If
                        end If
                    End If
                End IF
            Next

Open in new window

0
charlie324
Asked:
charlie324
1 Solution
 
charlie324Author Commented:
Hi,

thanks for your input.

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

thanks for the help
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now