I am trying to get all emails from my hotmail account. There are about 27744 mails in Inbox. I am trying to get all emails through POP3.
I am capturing 10 mails at a time. I am following this tutorial: http://www.example-code.com/vbdotnet/pop3_readLargeMailbox.asp
Now after getting 2400 mails it is showing me an error.
No Socket exists for Sending (2b)
How to resolve this problem? I am trying for a long time without any success.
The "No socket exists for sending" error message means one of the following:
I think in my case the option 2 is the cause. The connection is somehow lost. Can you guide me how to check connection and if lost then reconnect. Here is the code i am using:
Dim mailman As New Chilkat.MailMan() ' Any string argument automatically begins the 30-day trial. Dim success As Boolean success = mailman.UnlockComponent("My-Registered-Unlock-Code") If (success <> true) Then MsgBox("Component unlock failed") Exit Sub End If ' Set the POP3 server's hostname mailman.MailHost = "mail.chilkatsoft.com" ' Set the POP3 login/password. mailman.PopUsername = "myLogin" mailman.PopPassword = "myPassword" ' First, get the list of UIDLs for all emails in the mailbox. Dim sa As Chilkat.StringArray sa = mailman.GetUidls() Dim i As Long Dim numEmails As Long numEmails = sa.Count ' Download the emails in chunks of 10 emails each. Dim chunkBeginIdx As Long chunkBeginIdx = 0 Dim chunkEndIdx As Long chunkEndIdx = 9 If (chunkEndIdx >= numEmails) Then chunkEndIdx = numEmails - 1 End If Dim saChunk As New Chilkat.StringArray() While (chunkEndIdx < (numEmails - 1)) ' Build a chunk of 10 UIDLs. saChunk.Clear() For i = chunkBeginIdx To chunkEndIdx saChunk.Append(sa.GetString(i)) Next ' Display the UIDLs in this chunk... Dim chunkStr As String chunkStr = saChunk.SaveToText() TextBox1.Text = TextBox1.Text & chunkStr & vbCrLf TextBox1.Text = TextBox1.Text & "----" & vbCrLf & vbCrLf ' Download this chunk of email from the POP3 server. Dim bundle As Chilkat.EmailBundle bundle = mailman.FetchMultiple(saChunk) If (bundle Is Nothing ) Then MsgBox(mailman.LastErrorText) Exit Sub End If ' Process the bundle... ' (your application's processing code goes here...) ' Get the next chunk... chunkBeginIdx += 10 If (chunkBeginIdx >= numEmails) Then Exit For End If chunkEndIdx += 10 If (chunkEndIdx >= numEmails) Then chunkEndIdx = numEmails - 1 End If End While
I updated the online example. The call to mailman.GetUidls should be checked, like this:
' First, get the list of UIDLs for all emails in the mailbox. Dim sa As Chilkat.StringArray sa = mailman.GetUidls() If (sa Is Nothing ) Then TextBox1.Text = TextBox1.Text & mailman.LastErrorText & vbCrLf Exit Sub End If
Thanks for the fix. But i can not understand. The problem is while extracting mails the connection is somehow lost. How we can check whether an active connection is working or not? And if not working then how to reconnect and resume the job. And it should be in While.. End While loop. Please confirm.
Hi, Any update?
Use the DebugLogFilePath property to create a log file that contains the LastErrorText's of every Chilkat method call (for the imap object instance). Then examine the log file to find out where the connection becomes lost. You should see the connection become lost, and then each subsequent LastErrorText will indicate that "no socket exists".
Also, make sure you are using the very latest version (v9.3.2).
Finally, whenever posting a LastErrorText, make sure to include the entire amount, including the information at the beginning.