Exemple #1
0
        public void Connect()
        {
            _Listener = new TcpListener(System.Net.IPAddress.Any, 25);
            try
            {
                _Listener.Start();
                while (_Listener != null)
                {
                    // wait for incomming message
                    SmtpSession session = new SmtpSession(_Listener);

                    // catch events
                    session.Connected       += new EventHandler(Session_Connected);
                    session.MessageReceived += new EventHandler <MessageEventArgs>(Session_MessageReceived);
                    session.Disconnected    += new EventHandler(Session_Disconnected);

                    // connect
                    session.Connect();
                }
            }
            catch (Exception ex)
            {
                SetStatus(string.Format("Error: {0}", ex.Message));
            }
        }
Exemple #2
0
        public void Connect()
        {
            _Listener = new TcpListener(System.Net.IPAddress.Any, 25);
                        try
            {
                _Listener.Start();
                while (_Listener != null)
                {
                    // wait for incomming message
                    SmtpSession session = new SmtpSession(_Listener);

                    // catch events
                    session.Connected += new EventHandler(Session_Connected);
                    session.MessageReceived += new EventHandler<MessageEventArgs>(Session_MessageReceived);
                    session.Disconnected += new EventHandler(Session_Disconnected);

                    // connect
                    session.Connect();
                }
            }
            catch (Exception ex)
            {
                SetStatus(string.Format("Error: {0}", ex.Message));
            }
        }