OpenPop.NET
using OpenPop.Common.Logging; using OpenPop.Mime; using OpenPop.Mime.Decode; using OpenPop.Mime.Header; using OpenPop.Pop3; // FetchAllMessages("pop3.mail.ru", 995, true, "my_mail_ru_user", "mypass"); public static List<OpenPop.Mime.Message> FetchAllMessages(string hostname, int port, bool useSsl, string username, string password) { // The client disconnects from the server when being disposed using (Pop3Client client = new Pop3Client()) { // Connect to the server client.Connect(hostname, port, useSsl); // Authenticate ourselves towards the server client.Authenticate(username, password); // Get the number of messages in the inbox int messageCount = client.GetMessageCount(); // We want to download all messages List<OpenPop.Mime.Message> allMessages = new List<OpenPop.Mime.Message>(messageCount); // Messages are numbered in the interval: [1, messageCount] // Ergo: message numbers are 1-based. // Most servers give the latest message the highest number for (int i = messageCount; i > 0; i--) { allMessages.Add(client.GetMessage(i)); //client.GetMessage(i).Headers.Subject - так получаем тему письма } // Now return the fetched messages return allMessages; } }
This comment has been removed by a blog administrator.
ReplyDelete