コード例 #1
0
ファイル: SMTP_Client.cs プロジェクト: lanicon/ProtocolNet
        /// <summary>
        /// Sends message.
        /// </summary>
        /// <param name="to">Recipients. NOTE: recipients must be desination server recipients or when using SmartHost, then smart host must allow relay.</param>
        /// <param name="from">Sendrer's email address.</param>
        /// <param name="message">tream which contains message. NOTE: reading from stream is started from stream current position.</param>
        /// <returns>Returns true if send comeleted successfully.</returns>
        public bool Send(string[] to, string from, Stream message)
        {
            // Clear old errors
            m_pErrors.Clear();

            // ToDo split to TO ******

            // Check to if same e-domians(same server). Eg. [email protected], [email protected]
            // If not, group same e-domians and send them appropiate server. Eg. [email protected], [email protected]
            // This approach avoids sending message multiple times to same server.
            // Eg. we have [email protected], [email protected],  [email protected]
            // Then we must send [email protected], [email protected] - to lumisoft server
            //					 [email protected] - to ve server

            bool sendOk = SendMessageToServer(to, from, message);

            if (m_pLogWriter != null)
            {
                m_pLogWriter.Flush();
            }

            return(sendOk);
        }
コード例 #2
0
        /// <summary>
        /// Ends session, closes socket.
        /// </summary>
        private void EndSession()
        {
            if (m_pSocket != null)
            {
                m_pSocket.Shutdown(SocketShutdown.Both);
                m_pSocket.Close();
                m_pSocket = null;
            }

            m_pServer.RemoveSession(this);

            // Write logs to log file, if needed
            if (m_pServer.LogCommands)
            {
                m_pLogWriter.AddEntry("//----- Sys: 'Session:'" + this.SessionID + " removed " + DateTime.Now);

                m_pLogWriter.Flush();
            }
        }