How to check amount of sent/received data in MailK

2019-08-03 08:19发布

问题:

I have a program in which I'm sending and receiving e-mails with large attachments. I'm using MailKit. I would like to get actual upload speed (or amount of already sent data) for each email.

How can I get this?

回答1:

There's no way to get 100% accurate upload/downloads speeds in MailKit, but MailKit does have APIs that take an ITransferProgress argument, such as the send method:

http://www.mimekit.org/docs/html/Overload_MailKit_MailTransport_Send.htm

You can implement your own ITransferProgress class that tracks transfer of data such as messages which should give you a rough idea.

This will allow you to get notifications of how much data has been uploaded (or downloaded when used with the various ImapFolder and/or Pop3Client methods), and, based on that + overall time spent, you can calculate transfer speeds.



标签: c# smtp mailkit