if (!RequestMailList()) return LogError("Could not retrieve mail list"); [COLOR="#008000"]// returns true[/COLOR]
Thread.Sleep(random.Next(500) + 1000);
foreach (var mail in getMails())
{
if (mail.OpenMail()) [COLOR="#008000"]// returns true[/COLOR]
{
Thread.Sleep(random.Next(500) + 1000);
if (!mail.isSent)
{
if (mail.attachments > 0) [COLOR="#008000"]// returns 2 for example[/COLOR]
{
foreach (var item in mail.getItems()) [COLOR="#FF0000"]// no iteration, because getItems returns an empty list[/COLOR]
{
if (!mail.ReceiveItemFromMail(item)) return LogError("Could not receive item <{0}> from the mail <{1}>", item.name, mail.title);
Thread.Sleep(random.Next(500) + 1000);
}
}
}
}
else LogError("Could not open the mail <{0}>", mail.title); [COLOR="#008000"]// not called even once[/COLOR]
Thread.Sleep(random.Next(500) + 1000);
}
Thread.Sleep(5 * 60 * 1000); // doing stuff, 5 min pause
// same code but results differs
if (!RequestMailList()) return LogError("Could not retrieve mail list");[COLOR="#008000"] // returns true[/COLOR]
Thread.Sleep(random.Next(500) + 1000);
foreach (var mail in getMails())
{
if (mail.OpenMail()) [COLOR="#FF0000"][B]// returns false if the mail was previously opened[/B], and true if it is a new mail[/COLOR]
{
Thread.Sleep(random.Next(500) + 1000);
if (!mail.isSent)
{
if (mail.attachments > 0) [COLOR="#008000"]// returns 2 for example[/COLOR]
{
foreach (var item in mail.getItems()) [COLOR="#FF0000"]// no iteration, because getItems returns an empty list[/COLOR]
{
if (!mail.ReceiveItemFromMail(item)) return LogError("Could not receive item <{0}> from the mail <{1}>", item.name, mail.title);
Thread.Sleep(random.Next(500) + 1000);
}
}
}
}
else LogError("Could not open the mail <{0}> : error = {1}", mail.title, GetLastError().ToString());[COLOR="#FF0000"][B] // each previously opened mail raise a LastError.MailNoBody error[/B][/COLOR]
Thread.Sleep(random.Next(500) + 1000);
}