public void TestSingleBlockedAttachment()
        {
            var account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            var attachmentName = Guid.NewGuid().ToString() + ".dll";
            var tempFile       = Path.Combine(Path.GetTempPath(), attachmentName);

            File.WriteAllText(tempFile, "A");

            try
            {
                using (var attachment = new System.Net.Mail.Attachment(tempFile))
                {
                    var mail = new MailMessage();
                    mail.From = new MailAddress("*****@*****.**");
                    mail.To.Add("*****@*****.**");
                    mail.Subject         = "Test";
                    mail.Body            = "Test";
                    mail.BodyEncoding    = Encoding.GetEncoding(1252);
                    mail.SubjectEncoding = Encoding.GetEncoding(1252);
                    mail.Attachments.Add(attachment);

                    var smtpClient = new SmtpClient("localhost", 25);
                    smtpClient.Send(mail);
                }

                // Check that the message exists
                string message = POP3ClientSimulator.AssertGetFirstMessageText(account.Address, "test");
                CustomAssert.IsTrue(message.Contains(string.Format("The attachment {0} was blocked for delivery by the e-mail server.", attachmentName)));
            }
            finally
            {
                File.Delete(tempFile);
            }
        }
        public void TestSingleBlockedAttachment()
        {
            var account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");
             var attachmentName = Guid.NewGuid().ToString() + ".dll";
             var tempFile = Path.Combine(Path.GetTempPath(), attachmentName);
             File.WriteAllText(tempFile, "A");

             try
             {
            using (var attachment = new System.Net.Mail.Attachment(tempFile))
            {
               var mail = new MailMessage();
               mail.From = new MailAddress("*****@*****.**");
               mail.To.Add("*****@*****.**");
               mail.Subject = "Test";
               mail.Body = "Test";
               mail.BodyEncoding = Encoding.GetEncoding(1252);
               mail.SubjectEncoding = Encoding.GetEncoding(1252);
               mail.Attachments.Add(attachment);

               var smtpClient = new SmtpClient("localhost", 25);
               smtpClient.Send(mail);
            }

            // Check that the message exists
            string message = POP3ClientSimulator.AssertGetFirstMessageText(account.Address, "test");
            CustomAssert.IsTrue(message.Contains(string.Format("The attachment {0} was blocked for delivery by the e-mail server.", attachmentName)));

             }
             finally
             {
            File.Delete(tempFile);
             }
        }