Dim pop As POP3
pop.Initialize("pop.gmail.com", 995, "XXXXX@gmail.com", "XXXXX", "pop")
pop.UseSSL = True
Dim cs As CustomTrustManager
cs.InitializeAcceptAll
pop.SetCustomSSLTrustManager(cs)
wait for (pop.ListMessages) pop_ListCompleted (ListOK As Boolean, Messages As Map)
Log ("List Success: " & ListOK)
If ListOK = False Then
Log(LastException.Message)
Else
For i = 0 To Messages.Size - 1
wait for (pop.DownloadMessage(Messages.GetKeyAt(i),True)) pop_DownloadCompleted (Success As Boolean, MessageId As Int, MessageText As String)
If Success = False Then
Log(LastException.Message)
Else
'Parse the mail
mailcount=mailcount+1
MailParser.ParseMail(MessageText, "C:\Users\user\Google Drive")
End If
Next
End If
pop.close