Click here to Skip to main content
15,895,656 members
Articles / Programming Languages / C#

LumiSoft MailServer

Rate me:
Please Sign up or sign in to vote.
3.79/5 (22 votes)
17 Nov 2006CPOL1 min read 323.2K   4.9K   74  
Full featured SMTP/POP3/IMAP server
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Threading;

using LumiSoft.Net.NNTP.Client;

namespace LumiSoft.MailServer
{
    /// <summary>
    /// NNTP asynchronous message poster. This class is used by internally by 'Store To NNTP Newsgroup' message rule action.
    /// </summary>
    internal class _MessageRuleAction_NNTP_Async
    {
        private string       m_Server         = "";
        private int          m_Port           = 119;
        private string       m_Newsgroup      = "";
        private MemoryStream m_pMessageStream = null;

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="server">NNTP server.</param>
        /// <param name="port">NNTP server port. Default is 119.</param>
        /// <param name="newsgroup">NNTP newsgroup where to post message.</param>
        /// <param name="message">Message to post.</param>
        public _MessageRuleAction_NNTP_Async(string server,int port,string newsgroup,MemoryStream message)
        {
            m_Server         = server;
            m_Port           = port;
            m_Newsgroup      = newsgroup;
            m_pMessageStream = message;

            Thread tr = new Thread(new ThreadStart(this.Post));
            tr.Start();
        }


        #region method Post

        /// <summary>
        /// Posts message.
        /// </summary>
        private void Post()
        {     
            try{
                using(NNTP_Client nntp = new NNTP_Client()){
                    nntp.Connect(m_Server,m_Port);
                                                            
                    nntp.PostMessage(m_Newsgroup,m_pMessageStream);
                }
            }
            catch(Exception x){
                Error.DumpError(x,new System.Diagnostics.StackTrace());
            }
        }

        #endregion

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Estonia Estonia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions