/// <summary> 
 /// Required method for Designer support - do not modify 
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     this.POP3_Server = new LumiSoft.Net.POP3.Server.POP3_Server(this.components);
     this.IMAP_Server = new LumiSoft.Net.IMAP.Server.IMAP_Server(this.components);
     this.timer1 = new System.Timers.Timer();
     this.SMTP_Server = new LumiSoft.Net.SMTP.Server.SMTP_Server(this.components);
     ((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit();
     //
     // POP3_Server
     //
     this.POP3_Server.CommandIdleTimeOut = 60000;
     this.POP3_Server.LogCommands = false;
     this.POP3_Server.MaxBadCommands = 8;
     this.POP3_Server.SessionIdleTimeOut = 80000;
     this.POP3_Server.SessionResetted += new System.EventHandler(this.poP3_Server1_SessionResetted);
     this.POP3_Server.GetTopLines += new LumiSoft.Net.POP3.Server.GetTopLinesHandler(this.POP3_Server_GetTopLines);
     this.POP3_Server.GetMessage += new LumiSoft.Net.POP3.Server.GetMessageHandler(this.pop3_Server_GetMessage);
     this.POP3_Server.DeleteMessage += new LumiSoft.Net.POP3.Server.DeleteMessageHandler(this.pop3_Server_DeleteMessage);
     this.POP3_Server.SessionEnd += new System.EventHandler(this.poP3_Server1_SessionEnd);
     this.POP3_Server.SysError += new LumiSoft.Net.ErrorEventHandler(this.OnServer_SysError);
     this.POP3_Server.AuthUser += new LumiSoft.Net.POP3.Server.AuthUserEventHandler(this.Server_AuthenticateUser);
     this.POP3_Server.GetMessgesList += new LumiSoft.Net.POP3.Server.GetMessagesInfoHandler(this.pop3_Server_GetMessgesList);
     this.POP3_Server.SessionLog += new LumiSoft.Net.LogEventHandler(this.POP3_Server_SessionLog);
     this.POP3_Server.ValidateIPAddress += new LumiSoft.Net.ValidateIPHandler(this.POP3_Server_ValidateIPAddress);
     //
     // timer1
     //
     this.timer1.Interval = 15000;
     this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed);
     //
     // SMTP_Server
     //
     this.SMTP_Server.CommandIdleTimeOut = 60000;
     this.SMTP_Server.LogCommands = false;
     this.SMTP_Server.MaxBadCommands = 8;
     this.SMTP_Server.MaxMessageSize = 1000000;
     this.SMTP_Server.MaxRecipients = 100;
     this.SMTP_Server.SessionIdleTimeOut = 80000;
     this.SMTP_Server.AuthUser += new LumiSoft.Net.SMTP.Server.AuthUserEventHandler(this.Server_AuthenticateUser);
     this.SMTP_Server.SessionLog += new LumiSoft.Net.LogEventHandler(this.SMTP_Server_SessionLog);
     this.SMTP_Server.ValidateMailFrom += new LumiSoft.Net.SMTP.Server.ValidateMailFromHandler(this.smtp_Server_ValidateSender);
     this.SMTP_Server.SysError += new LumiSoft.Net.ErrorEventHandler(this.OnServer_SysError);
     this.SMTP_Server.StoreMessage += new LumiSoft.Net.SMTP.Server.NewMailEventHandler(this.smtp_Server_NewMailEvent);
     this.SMTP_Server.ValidateMailTo += new LumiSoft.Net.SMTP.Server.ValidateMailToHandler(this.smtp_Server_ValidateRecipient);
     this.SMTP_Server.ValidateMailboxSize += new LumiSoft.Net.SMTP.Server.ValidateMailboxSize(this.SMTP_Server_ValidateMailBoxSize);
     this.SMTP_Server.ValidateIPAddress += new LumiSoft.Net.ValidateIPHandler(this.SMTP_Server_ValidateIPAddress);
     //
     //
     //
     this.IMAP_Server.SysError += new LumiSoft.Net.ErrorEventHandler(OnServer_SysError);
     this.IMAP_Server.AuthUser += new LumiSoft.Net.IMAP.Server.AuthUserEventHandler(IMAP_Server_AuthUser);
     this.IMAP_Server.GetFolders += new FoldersEventHandler(IMAP_Server_GetFolders);
     this.IMAP_Server.GetSubscribedFolders += new FoldersEventHandler(IMAP_Server_GetSubscribedFolders);
     this.IMAP_Server.SubscribeFolder += new FolderEventHandler(IMAP_Server_SubscribeFolder);
     this.IMAP_Server.UnSubscribeFolder += new FolderEventHandler(IMAP_Server_UnSubscribeFolder);
     this.IMAP_Server.CreateFolder += new FolderEventHandler(IMAP_Server_CreateFolder);
     this.IMAP_Server.DeleteFolder += new FolderEventHandler(IMAP_Server_DeleteFolder);
     this.IMAP_Server.RenameFolder += new FolderEventHandler(IMAP_Server_RenameFolder);
     this.IMAP_Server.GetMessagesInfo += new MessagesEventHandler(IMAP_Server_GetMessagesInfo);
     this.IMAP_Server.DeleteMessage += new MessageEventHandler(IMAP_Server_DeleteMessage);
     this.IMAP_Server.StoreMessage += new MessageEventHandler(IMAP_Server_StoreMessage);
     this.IMAP_Server.StoreMessageFlags += new MessageEventHandler(IMAP_Server_StoreMessageFlags);
     this.IMAP_Server.CopyMessage += new MessageEventHandler(IMAP_Server_CopyMessage);
     this.IMAP_Server.GetMessage += new MessageEventHandler(IMAP_Server_GetMessage);
     this.IMAP_Server.SessionLog += new LumiSoft.Net.LogEventHandler(this.IMAP_Server_SessionLog);
     //
     // MailServer
     //
     this.ServiceName = "Service1";
     ((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit();
 }
Example #2
0
        public FormMain()
        {
            InitializeComponent();
            try
            {
                // Control.CheckForIllegalCrossThreadCalls = false;
                DbHelperSQLite.connectionString = _sqlitstr;
                string  sqlstr = "SELECT * FROM CONFIG WHERE ID=1";
                DataSet ds     = DbHelperSQLite.Query(sqlstr);
                if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows != null)
                {
                    tboxRIP.Text             = ds.Tables[0].Rows[0]["RIP"].ToString();
                    tboxRPort.Text           = ds.Tables[0].Rows[0]["RPORT"].ToString();
                    tboxRUser.Text           = ds.Tables[0].Rows[0]["RUSER"].ToString();
                    tboxRPSW.Text            = ds.Tables[0].Rows[0]["RPSW"].ToString();
                    textBoxConnStr.Text      = ds.Tables[0].Rows[0]["TCONN"].ToString();
                    textBoxTFSUser.Text      = ds.Tables[0].Rows[0]["TUSER"].ToString();
                    textBoxTFSPsw.Text       = ds.Tables[0].Rows[0]["TPSW"].ToString();
                    tboxMailIP.Text          = ds.Tables[0].Rows[0]["TMAIL"].ToString();
                    tboxMailPort.Text        = ds.Tables[0].Rows[0]["TMAILPORT"].ToString();
                    radioButtonGroup.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["TQUN"]);
                    radioButtonOne.Checked   = !radioButtonGroup.Checked;
                    checkBoxSys.Checked      = Convert.ToBoolean(ds.Tables[0].Rows[0]["TSYS"]);
                    tboxSysAlertTime.Text    = ds.Tables[0].Rows[0]["TSYSTIME"].ToString();
                    checkBoxIM.Checked       = Convert.ToBoolean(ds.Tables[0].Rows[0]["TIM"]);
                    jbtxno = ds.Tables[0].Rows[0]["JBTXN"].ToString();
                    textBoxTFSDetailURL.Text = ds.Tables[0].Rows[0]["TFSDETAILURL"].ToString();
                    WriteLog("参数设置读取成功!");
                }
                else
                {
                    WriteLog("参数设置读取失败!");
                }

                RootObj             = new RTXSAPIRootObj(); //创建根对象
                AObj                = RootObj.CreateAPIObj();
                AObj.OnRecvMessage += new _IRTXSAPIObjEvents_OnRecvMessageEventHandler(RecvMessageEvent);


                this.SMTP_Server = new LumiSoft.Net.SMTP.Server.SMTP_Server(this.components);
                //
                // SMTP_Server
                //
                SMTP_Server.Enabled = false;
                this.SMTP_Server.CommandIdleTimeOut   = 60000;
                this.SMTP_Server.LogCommands          = false;
                this.SMTP_Server.MaxBadCommands       = 8;
                this.SMTP_Server.MaxMessageSize       = 1000000;
                this.SMTP_Server.MaxRecipients        = 100;
                this.SMTP_Server.SessionIdleTimeOut   = 80000;
                this.SMTP_Server.AuthUser            += new LumiSoft.Net.SMTP.Server.AuthUserEventHandler(this.Server_AuthenticateUser);
                this.SMTP_Server.SessionLog          += new LumiSoft.Net.LogEventHandler(this.SMTP_Server_SessionLog);
                this.SMTP_Server.ValidateMailFrom    += new LumiSoft.Net.SMTP.Server.ValidateMailFromHandler(this.smtp_Server_ValidateSender);
                this.SMTP_Server.SysError            += new LumiSoft.Net.ErrorEventHandler(this.OnServer_SysError);
                this.SMTP_Server.StoreMessage        += new LumiSoft.Net.SMTP.Server.NewMailEventHandler(this.smtp_Server_NewMailEvent);
                this.SMTP_Server.ValidateMailTo      += new LumiSoft.Net.SMTP.Server.ValidateMailToHandler(this.smtp_Server_ValidateRecipient);
                this.SMTP_Server.ValidateMailboxSize += new LumiSoft.Net.SMTP.Server.ValidateMailboxSize(this.SMTP_Server_ValidateMailBoxSize);
                this.SMTP_Server.ValidateIPAddress   += new LumiSoft.Net.ValidateIPHandler(this.SMTP_Server_ValidateIPAddress);

                //------- SMTP Settings ---------------------------------------------//
                SMTP_Server.IpAddress          = tboxMailIP.Text;
                SMTP_Server.Port               = Convert.ToInt32(tboxMailPort.Text);
                SMTP_Server.Threads            = 200;
                SMTP_Server.SessionIdleTimeOut = 300 * 1000;   // 毫秒
                SMTP_Server.CommandIdleTimeOut = 120 * 1000;   // 毫秒
                SMTP_Server.MaxMessageSize     = 10 * 1000000; // 字节
                SMTP_Server.MaxRecipients      = 100;
                SMTP_Server.MaxBadCommands     = 8;
                SMTP_Server.LogCommands        = false;
                WriteLog("系统初始化成功!");
            }
            catch (System.Exception ex)
            {
                WriteLog("系统初始化失败!" + ex.Message);
            }
        }