pamela rizk
asked on
imap read mail
dear all
i have the below code where i am trying to rad mail using imap
would you please clarify whats is teh difference between SelectMailbox("Inbox"), GetAllMails("Inbox")
, inbox.Search("ALL") than k you
i have the below code where i am trying to rad mail using imap
would you please clarify whats is teh difference between SelectMailbox("Inbox"), GetAllMails("Inbox")
, inbox.Search("ALL") than k you
Dim inbox As ActiveUp.Net.Mail.Mailbox = IMAPMail.SelectMailbox("Inbox")
Dim numberofEMails = IMAPMail.GetNumberOfEmails()
If numberofEMails = 0 Then 'check number of messages for being 0 (none)
errormsg = "There is no Messages to retrieve from IMAP Server"
Throw New Exception()
End If
Try
Dim email As ActiveUp.Net.Mail.Message = IMAPMail.GetAllMails("Inbox")
Catch ex As Exception
errormsg = socdll_common.AppReturnErr(-1, "Could not get mail list of messages: Error = " & ex.Message)
Throw New Exception()
End Try
Dim ids As Integer() = inbox.Search("ALL")
If ids.Length > 0 Then
Try
Dim count As Integer = 1
Dim msg1 As ActiveUp.Net.Mail.Message = Nothing
For Each email As ActiveUp.Net.Mail.Message In IMAPMail.GetAllMails("Inbox")
count = count - 1
msg1 = inbox.Fetch.MessageObject(ids(count))
count = count + 1
Next
Catch ex As Exception
errormsg = socdll_common.AppReturnErr(-1, "Error While reading Email Using IMAP Protocols..." & ex.Message.ToString.Trim)
Throw New Exception()
End Try
Else
errormsg = socdll_common.AppReturnErr(-1, "Could not get mail list of messages from IMAP server")
Throw New Exception()
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.