NNTP FeaturesNews groups are well known and were widely used in the past, before the development of online forums and message boards. Their usefulness continues because they provide a "centralized" source of information in a "single source" discussion format. Many well-known news groups are now considered a resource for "reference" information; news groups will continue to be a valuable information resource for a very long time.
ActiveUp.MailSystem provides helpful tools to facilitate posting and retrieving news group articles. You can enable your application to post to news groups automatically. For example, web site administrators frequently post ads on their web sites, but using ActiveUp.MailSystem would give them the ability to post ads in targeted news groups. Similarly, if you developed an astronomical application and you would like to retrieve all images posted at alt.binaries.pictures.astro, you could easily integrate ActiveUp.MailSystem within your application thereby enabling it to browse the news group, read the articles and store the binaries in a local directory.
Official specifications and standards about NNTP can be found in the following documents:
List News groups and articles Easily
ActiveUp.MailSystem makes it easy to maintain a news group, and still allow users to read and post articles from your web site.
This example demonstrates how easy it is to retrieve all newly posted articles:
Show C# code
// We create nntp client object. NntpClient nntp = new NntpClient();
// We connect to the server nntp.Connect("news.example.com");
//Get the news group on the server NewsGroupCollection groups = nntp.GetNewsGroups();
foreach (NewsGroup group in groups) { Console.WriteLine("Group name : {0}", group.Name); }
// Get a news group on the server NewsGroup group = nntp.SelectGroup("misc.news.internet.discuss");
// Get all messages MessageCollection messages = new MessageCollection(); for (int index = 0; index < group.ArticleCount; index++) { Message message = group.RetrieveArticleObject(index); messages.Add(message); Console.WriteLine("Subject : {0}", message.Subject); }
// Gets article ids that belong to the "misc.news.internet.discuss" // newsgroup and have been added less than one month ago. string[] newids = nntp.GetNewArticleIds("misc.news.internet.discuss", DateTime.Now.AddMonths(-1));
// We get each article as an object. foreach (string articleId in newids) { Message message = nntp.RetrieveArticleObject(articleId); Console.WriteLine("Subject : {0}", message.Subject); }
Download Full Articles or only Headers
You might want to display basic information in your application without having to download the full article. This sample demonstrates how easy it is to download only the header of an article based on its ID:
Show C# code
// We create nntp client object. NntpClient nntp = new NntpClient();
// We connect to the server nntp.Connect("news.example.com");
// Get a news group on the server NewsGroup group = nntp.SelectGroup("misc.news.internet.discuss");
// Retrieve message header at index 1 Header header = group.RetrieveHeaderObject(1);
// Retrieve full message at index 1 Message message = group.RetrieveArticleObject(1);
Secure Authentication
As with SMTP authentication, ActiveUp.MailSystem handles NNTP authentication protocol very easily as demonstrated in the following example:
Show C# code
// We connect to the server using a login and password nntp.Connect("news.example.com", "user1", "pass1");
|