public void ContactEmailOwners()
        {
            var packageName = "NuGetGallery.FunctionalTests.Fluent.ContactEmailTest";
            var subject = string.Empty;

            // Contact the package's owners.
            I.LogOn(EnvironmentSettings.TestAccountName, EnvironmentSettings.TestAccountPassword);
            I.Open(UrlHelper.BaseUrl + "/packages/" + packageName);
            I.Click("a:contains('Contact Owners')");
            I.Enter(GetMessage()).In("#Message");
            I.Click("input[value='Send']");

            // Validate in-site message to owner
            I.Expect.Url(x => x.AbsoluteUri.EndsWith("/packages/" + packageName));
            I.Expect.Count(1).Of(@"p:contains('Your message has been sent to the owners of " + packageName + "')");

            // Validate owner receives a copy of the message
            // Wait for 30 secs. to make sure that the mail is delivered properly.
            var received = false;
            for (int i = 0; ((i < 10) && !received); i++)
            {
                System.Threading.Thread.Sleep(30000);
                subject = string.Empty;
                var mailHelper = new MailHelper();
                received = mailHelper.IsMailSentForContactOwner(packageName, out subject);
            }

            var userMessage = string.Format("Owner not contacted correctly. Actual subject : {0}", subject);
            Assert.True(received, userMessage);
        }
        public async Task ContactEmailAbuse()
        {
            var packageName = "NuGetGallery.FunctionalTests.Fluent.ContactEmailTest";
            var version = "1.0.0";
            var subject = string.Empty;
            var received = false;

            await UploadPackageIfNecessary(packageName, version);

            // Send an abuse report for the package.
            I.Open(UrlHelper.BaseUrl + "/packages/" + packageName);
            I.Click("a:contains('Report Abuse')");
            I.Enter("*****@*****.**").In("#Email");
            I.Select("Other").From("#Reason");
            I.Enter(GetMessage()).In("#Message");
            I.Click("input[value='Report']");

            // Validate in-site message to owner
            I.Expect.Url(x => x.AbsoluteUri.EndsWith("/packages/" + packageName + "/" + version));
            I.Expect.Count(1).Of(@"p:contains('Your abuse report has been sent to the gallery operators')");

            // Validate owner receives a copy of the message
            // Wait for up to 5 mins. to make sure that the mail is delivered properly.
            for (int i = 0; ((i < 10) && !received); i++)
            {
                System.Threading.Thread.Sleep(30000);
                subject = string.Empty;
                var mailHelper = new MailHelper();
                received = mailHelper.IsMailSentForAbuseReport(packageName, version, "Other", out subject);
            }

            var userMessage = string.Format("Abuse report not sent to the owner properly. Actual subject : {0}", subject);
            Assert.True(received, userMessage);
        }