C# Bulk Mail Download With only 4 mails downloaded

peterzhou

Client
Регистрация
06.04.2011
Сообщения
61
Благодарностей
15
Баллы
8
Код:
// download all messages from yandex via POP3 and add results to the table
Tuple<string, string, string, string>[] allMails;
allMails = ZennoPoster.BulkMailDownload("[email protected]", 
       "ххххххххххх", "pop.yandex.ru", 995, true,
       ZennoLab.InterfacesLibrary.Enums.Email.EmailProtocol.POP3, 
       24*100, 20, false);
 
// loop fo all messages
foreach(Tuple<string, string, string, string> tuple in allMails)
{
    // adding messages to the table called Tabl1
    // tuple.Item1 - sibject, tuple.Item2 - from, tuple.Item3 - html message, tuple.Item4 - text message
      List<string> tmp = new List<string>();
       tmp.Add(tuple.Item1);
       tmp.Add(tuple.Item2);
       tmp.Add(tuple.Item3);
       tmp.Add(tuple.Item4);
       project.Tables["Tabl1"].AddRow(tmp);
}
When I use this to my email and save Tabl1 to aaa.xlsx, I got only 4 mails. I have a lot of mails in my email account. What is the problem(I know little C#)?
 
Регистрация
01.02.2011
Сообщения
99
Благодарностей
15
Баллы
0
Maybe the issue has a solution in this line?

Код:
ZennoLab.InterfacesLibrary.Enums.Email.EmailProtocol.POP3, 24*100, 20, false);
From the wiki I see "24*100" is a parameter for:

lastHours
Type: System.Int32
If message older than specified amount of hours will not be returned. Default value is 2 hours
On the wiki there is no mention of the units used for the parameter in "lastHours". Does anyone know what 24*100 relates to? 24hrs x 100 ?


Also the maxCount paramter interger "20", in this line (EmailProtocol.POP3, 24*100, 20, false), should exceed the expected number of emails to download. At the moment, you would only be downloading 20 mails per run, if my read is correct.

I'm not familiar with c#, but on the basis of experience with other lanuages, the "foreach" loop & "ZennoPoster.BulkMailDownload" need error/exception handling boilerplate to output to ZP log Class. At the moment, it looks like the code would swallow exceptions/errors.
 

purush84

Client
Регистрация
07.11.2011
Сообщения
259
Благодарностей
38
Баллы
0
Код:
ZennoLab.InterfacesLibrary.Enums.Email.EmailProtocol.POP3, 24*100, 5000, false);
In this code 24*100 Means 24 Hrs and 100 days.If message older than specified amount of hours will not be returned..

5000 Means BulkMailDownloader Download Max 5000 Messages from Mail Server..

False Means BulkMailDownloader will not delete Messages in Mail Server..

you can modify these settings in code what you want..!

i tested using this code working good..!!:D
 
  • Спасибо
Реакции: peterzhou

peterzhou

Client
Регистрация
06.04.2011
Сообщения
61
Благодарностей
15
Баллы
8
I got the reason. When I save Tabl1 to a xls or xlsx file, it is always only 4 mails.

When I save Tabl1 to a txt file, it works ok.
 

purush84

Client
Регистрация
07.11.2011
Сообщения
259
Благодарностей
38
Баллы
0

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)