Esempio n. 1
0
        public void ReceiveMails(string Username, int OrderID)
        {
            jmail.Message Msg = new jmail.Message();
            jmail.POP3 jpop = new jmail.POP3();
            if (OrderID != 0)
            {
                SqlDataReader dataReader = this.ExtGetSetting(Username, OrderID);
                try
                {
                    if (dataReader.Read())
                    {
                        if (dataReader["PopServer"].ToString() != "" && dataReader["PopUsername"].ToString() != "")
                        {
                            jpop.Connect(dataReader["PopUsername"].ToString(), dataReader["PopPassword"].ToString(), dataReader["PopServer"].ToString(), Int32.Parse(dataReader["PopPort"].ToString()));
                            for (int i = 1; i <= jpop.Count; i++)
                            {
                                Msg = jpop.Messages[i];
                                this.SaveExtMail(Msg, Username, dataReader["Email"].ToString(), jpop.GetMessageUID(i));

                            }
                            jpop.Disconnect();
                        }
                    }
                }
                finally
                {

                    dataReader.Close();
                }
            }
        }
Esempio n. 2
0
        private void TestPopConn(string PopServer,string Uname,string Pwd,string Port,int OrderID)
        {
            int Count;
            jmail.Message Msg=new jmail.Message();
            jmail.POP3 jpop = new jmail.POP3();
            try
            {

                jpop.Connect(Uname,Pwd,PopServer,Int32.Parse(Port));

                Count = jpop.Count;
                switch (OrderID)
                {
                    case 1:
                        this.lblResultRep1.Visible = true;
                        this.lblResultRep1.Text = "���Գɹ�,���� "+Count.ToString()+" ���ʼ�";
                        break;
                    case 2:
                        this.lblResultRep2 .Visible = true;
                        this.lblResultRep2.Text = "���Գɹ�,���� "+Count.ToString()+" ���ʼ�";
                        break;
                    case 3:
                        this.lblResultRep3 .Visible = true;
                        this.lblResultRep3.Text = "���Գɹ�,���� "+Count.ToString()+" ���ʼ�";
                        break;
                    default:
                        break;
                }

                jpop.Disconnect();

            }
            catch(Exception e)
            {
                switch (OrderID)
                {
                    case 1:
                        this.lblResultRep1.Visible = true;
                        this.lblResultRep1.Text = "δ�����ӵ���ָ����[�����ʼ�������],�������˴����[�û���]��[����]��";
                        break;
                    case 2:
                        this.lblResultRep2 .Visible = true;
                        this.lblResultRep2.Text = "δ�����ӵ���ָ����[�����ʼ�������],�������˴����[�û���]��[����]��";
                        break;
                    case 3:
                        this.lblResultRep3 .Visible = true;
                        this.lblResultRep3.Text = "δ�����ӵ���ָ����[�����ʼ�������],�������˴����[�û���]��[����]��";
                        break;
                    default:
                        break;
                }

            }
        }