- Code: Select all
StringBuilder sb = new StringBuilder();
ImapMessageCollection msgs = imap.Search("'Subject' Contains '2021'");
for(int i = 0; i < msgs.Count; i++)
{
Spire.Email.MailMessage originalMail = imap.GetMessageText(msgs(i));
//Extract the body text
String bodyText = originalMail.BodyText;
sb.Append(bodyText);
}
The problem is that there's an error which says 'Method name expected' for msgs(i). msgs is a variable, apparently. What is the correct format for this line 'Spire.Email.MailMessage originalMail = imap.GetMessageText(msgs(i));'?
Thank you.