Exemplo n.º 1
0
        private void _bCheckBounce_Click(object sender, EventArgs e)
        {
            // We instantiate the pop3 client.
            Pop3Client pop = new Pop3Client();

            try
            {
                this.AddLogEntry(string.Format("Connection to the pop 3 server : {0}", _tbPop3Server.Text));

                // We connect to the pop3 client
                pop.Connect(_tbPop3Server.Text, _tbUserName.Text, _tbPassword.Text);

                if (pop.MessageCount > 0)
                {
                    // We retrive a message at a particular index (index 1 in this sample)
                    ActiveUp.Net.Mail.Message message = pop.RetrieveMessageObject(1);

                    BounceResult br = message.GetBounceStatus();

                    if (br.Level == 3)
                    {
                        this.AddLogEntry(string.Format("Message sent to  {0} is bounced", br.Email));
                    }

                    else
                    {
                        this.AddLogEntry(string.Format("Message sent to {0} is not bounced", br.Email));
                    }
                }

                else
                {
                    this.AddLogEntry("There is no message in this pop3 account");
                }
            }

            catch (Pop3Exception pexp)
            {
                this.AddLogEntry(string.Format("Pop3 Error: {0}", pexp.Message));
            }

            catch (Exception ex)
            {
                this.AddLogEntry(string.Format("Failed: {0}", ex.Message));
            }

            finally
            {
                if (pop.IsConnected)
                {
                    pop.Disconnect();
                }
            }
        }
Exemplo n.º 2
0
        public static void Run()
        {
            // The path to the File directory.
            string dataDir  = RunExamples.GetDataDir_Email();
            string dstEmail = dataDir + "test.eml";

            string       fileName = dstEmail;
            MailMessage  mail     = MailMessage.Load(fileName);
            BounceResult result   = mail.CheckBounced();

            Console.WriteLine(fileName);
            Console.WriteLine("IsBounced : " + result.IsBounced);
            Console.WriteLine("Action : " + result.Action);
            Console.WriteLine("Recipient : " + result.Recipient);
            Console.WriteLine(Environment.NewLine + "Bounce information displayed successfully.");
        }
Exemplo n.º 3
0
        public static void Run()
        {
            // ExStart:GetDeliveryStatusNotificationMessages
            string       fileName = RunExamples.GetDataDir_Email() + "failed1.msg";
            MailMessage  mail     = MailMessage.Load(fileName);
            BounceResult result   = mail.CheckBounced();

            Console.WriteLine(fileName);
            Console.WriteLine("IsBounced : " + result.IsBounced);
            Console.WriteLine("Action : " + result.Action);
            Console.WriteLine("Recipient : " + result.Recipient);
            Console.WriteLine();
            Console.WriteLine("Reason : " + result.Reason);
            Console.WriteLine("Status : " + result.Status);
            Console.WriteLine("OriginalMessage ToAddress 1: " + result.OriginalMessage.To[0].Address);
            Console.WriteLine();
            // ExEnd:GetDeliveryStatusNotificationMessages
        }