Hi all,
I'm getting the following error intermittently. It is able to connect now and again, however, in most instances it errors when calling "imap.UseBestLogin(_user, _password)" with "Tried to read a line. No data received. "
Any help would be very much appreciated
Private Const _server As String = "outlook.office365.com"
Private Const _user As String = "xxxxxx"
Private Const _password As String = "xxxxxxx"
ServicePointManager.SecurityProtocol = _
SecurityProtocolType.Tls12
Using imap As New Imap
Try
imap.ConnectSSL(_server)
imap.UseBestLogin(_user, _password)
imap.SelectInbox()
'Find all unseen messages.
Dim uids As List(Of Long) = imap.Search(Flag.Unseen)
lblOutput.Text = "Number of unseen messages is: " _
+ uids.Count.ToString
For Each uid As Long In uids
' Download and parse each message.
Dim email As IMail = New MailBuilder() _
.CreateFromEml(imap.GetMessageByUID(uid))
' Display email data, save attachments:
ProcessMessage(email)
Next
imap.Close(False)
Catch ex As Exception
lblOutput.Text = ex.ToString
Finally
imap.Dispose()
End Try
End Using