当前位置: 首页>>代码示例>>C#>>正文


C# IMAPSimulator.Fetch方法代码示例

本文整理汇总了C#中IMAPSimulator.Fetch方法的典型用法代码示例。如果您正苦于以下问题:C# IMAPSimulator.Fetch方法的具体用法?C# IMAPSimulator.Fetch怎么用?C# IMAPSimulator.Fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMAPSimulator的用法示例。


在下文中一共展示了IMAPSimulator.Fetch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestFetchCharsetInQuotesWithoutSpace

        public void TestFetchCharsetInQuotesWithoutSpace()
        {
            hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             SMTPClientSimulator.StaticSendRaw(account.Address, account.Address,
            "From: [email protected]\r\n" +
            "Content-Type: text/plain; charset =\"iso-8859-1\"\r\n" +
            "\r\n" +
            "Test\r\n");

             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);

             IMAPSimulator sim = new IMAPSimulator(account.Address, "test", "Inbox");
             string result = sim.Fetch("1 BODYSTRUCTURE");
             sim.Disconnect();

             Assert.IsTrue(result.Contains("(\"CHARSET\" \"iso-8859-1\")"), result);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:18,代码来源:MIME.Parameters.cs

示例2: TestBodyStructureWithNonLatinCharacterTest3

        public void TestBodyStructureWithNonLatinCharacterTest3()
        {
            string @messageText =
            "To: [email protected]\r\n" +
            "Content-Type: multipart/mixed;\r\n" +
            " boundary=\"------------000008080307000003010005\"\r\n" +
            "\r\n" +
            "This is a multi-part message in MIME format.\r\n" +
            "--------------000008080307000003010005\r\n" +
            "Content-Type: text/plain; charset=ISO-8859-1; format=flowed\r\n" +
            "Content-Transfer-Encoding: 7bit\r\n" +
            "\r\n" +
            "Test\r\n" +
            "\r\n" +
            "--------------000008080307000003010005\r\n" +
            "Content-Type: image/png;\r\n" +
            " name=\"=?ISO-8859-1?Q?=F6=50=C4=C9=CD=C1=D6=60=F6=F6=E4=27=2E=70=6E=67?=\"\r\n" +
            "Content-Transfer-Encoding: base64\r\n" +
            "Content-Disposition: inline;\r\n" +
            " filename*=ISO-8859-1''%F6%50%C4%C9%CD%C1%D6%60%F6%F6%E4%27%2E%70%6E%67\r\n" +
            "\r\n" +
            "iVBORw0KGgoAAAANSUhEUgAAAqgAAAH4CAIAAAAJvIhhAAAAAXNSR0IArs4c6QAAAARnQU1B\r\n" +
            "AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA\r\n" +
            "--------------000008080307000003010005--\r\n";

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             Assert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

             Utilities.AssertMessageExistsInFolder(account.IMAPFolders[0], 1);

             IMAPSimulator oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

             Assert.IsTrue(result.Contains("\"FILENAME\" \"=?ISO-8859-1?Q?=F6=50=C4=C9=CD=C1=D6=60=F6=F6=E4=27=2E=70=6E=67?=\""));
             Assert.IsTrue(result.Contains("\"NAME\" \"=?ISO-8859-1?Q?=F6=50=C4=C9=CD=C1=D6=60=F6=F6=E4=27=2E=70=6E=67?=\""));
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:40,代码来源:IMAP.cs

示例3: TestRetrievalOfMessageInDeletedFolderUsingIMAP

        public void TestRetrievalOfMessageInDeletedFolderUsingIMAP()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
             string deletedMessageText = _settings.ServerMessages.get_ItemByName("MESSAGE_FILE_MISSING").Text;

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody");

             hMailServer.IMAPFolder inbox = account.IMAPFolders.get_ItemByName("Inbox"); ;

             Utilities.AssertMessageExistsInFolder(inbox, 1);

             hMailServer.Message message = inbox.Messages[0];

             DirectoryInfo dir = new DirectoryInfo(Path.GetFullPath(message.Filename));
             DirectoryInfo parent = dir.Parent.Parent.Parent;
             parent.Delete(true);

             IMAPSimulator sim = new IMAPSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             sim.SelectFolder("INBOX");
             string result = sim.Fetch("1 BODY[1]");

             Assert.IsTrue(result.Contains(deletedMessageText.Replace("%MACRO_FILE%", message.Filename)));
             Utilities.AssertReportedError();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:27,代码来源:StabilitySanityTests.cs

示例4: TestBodyStructureWithNonLatinCharacterSingleLineWithSpace

        public void TestBodyStructureWithNonLatinCharacterSingleLineWithSpace()
        {
            string @messageText =
            "Return-Path: [email protected]\r\n" +
            "Delivered-To: [email protected]\r\n" +
            "Received: from www.hmailserver.com ([127.0.0.1])\r\n" +
            "	by mail.hmailserver.com\r\n" +
            "	; Tue, 16 Jun 2009 21:39:18 +0200\r\n" +
            "MIME-Version: 1.0\r\n" +
            "Date: Tue, 16 Jun 2009 21:39:18 +0200\r\n" +
            "From: <[email protected]>\r\n" +
            "To: <[email protected]>\r\n" +
            "Subject: sdafsda\r\n" +
            "Message-ID: <[email protected]>\r\n" +
            "X-Sender: [email protected]\r\n" +
            "User-Agent: RoundCube Webmail/0.2.2\r\n" +
            "Content-Type: multipart/mixed;\r\n" +
            "	boundary=\"=_b63968892a76b1a5be17f4d37b085f54\"\r\n" +
            "\r\n" +
            "--=_b63968892a76b1a5be17f4d37b085f54\r\n" +
            "Content-Transfer-Encoding: 8bit\r\n" +
            "Content-Type: text/plain; charset=\"UTF-8\"\r\n" +
            "\r\n" +
            "--=_b63968892a76b1a5be17f4d37b085f54\r\n" +
            "Content-Transfer-Encoding: base64\r\n" +
            "Content-Type: application/x-zip; charset=\"UTF-8\";\r\n" +
            " name*=\"UTF-8''m%C3%A4%C3%B6 m%C3%A4%C3%B6.zip\"; \r\n" +
            "Content-Disposition: attachment;\r\n" +
            " filename*=\"UTF-8''m%C3%A4%C3%B6 m%C3%A4%C3%B6.zip\"; \r\n" +
            "\r\n" +
            "iVBORw0KGgoAAAANSUhEUgAAAqgAAAH4CAIAAAAJvIhhAAAAAXNSR0IArs4c6QAAAARnQU1BAACx\r\n" +
            "jwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAIr1JREFU\r\n" +
            "eF7t29GSYzluBND1/3/0ejb6wY6emK2WrpQEkaefdQvAAcn02OH/+fe///0v/wgQIECAAIESgb+C\r\n" +
            "3z8CBAgQIECgROBfJXMakwABAgQIEPjP/5qfAgECBAgQINAjIPh7dm1SAgQIECDgv/idAQIECBAg\r\n" +
            "--=_b63968892a76b1a5be17f4d37b085f54--\r\n" +
            "";

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             Assert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

             Utilities.AssertMessageExistsInFolder(account.IMAPFolders[0], 1);

             IMAPSimulator oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

             Assert.IsFalse(result.Contains("''"), result);
             Assert.IsTrue(result.Contains("\"FILENAME\" \"=?UTF-8?Q?m=C3=A4=C3=B6 m=C3=A4=C3=B6.zip?=\""), result);
             Assert.IsTrue(result.Contains("\"NAME\" \"=?UTF-8?Q?m=C3=A4=C3=B6 m=C3=A4=C3=B6.zip?=\""), result);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:53,代码来源:IMAP.cs

示例5: TestBodyStructureWithNonLatinCharacterSingleLineEncoded

        public void TestBodyStructureWithNonLatinCharacterSingleLineEncoded()
        {
            string @messageText =
            "Message-ID: <[email protected]*******.**>\r\n" +
            "Date: Fri, 29 May 2009 11:53:03 +0200\r\n" +
            "Subject: attachment's name test\r\n" +
            "From: [email protected]\r\n" +
            "To: [email protected]\r\n" +
            "User-Agent: SquirrelMail/1.4.19\r\n" +
            "MIME-Version: 1.0\r\n" +
            "Content-Type: multipart/mixed;boundary=\"----=_20090529115303_60479\"\r\n" +
            "X-Priority: 3 (Normal)\r\n" +
            "Importance: Normal\r\n" +
            "\r\n" +
            "------=_20090529115303_60479\r\n" +
            "Content-Type: text/plain; charset=\"iso-8859-2\"\r\n" +
            "Content-Transfer-Encoding: 8bit\r\n" +
            "\r\n" +
            "test.±æê³ñ󶼿.txt\r\n" +
            "------=_20090529115303_60479\r\n" +
            "Content-Type: text/plain; name=\r\n" +
            "    =?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\r\n" +
            "Content-Transfer-Encoding: 8bit\r\n" +
            "Content-Disposition: attachment; filename=\"\r\n" +
            "    =?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\"\r\n" +
            "\r\n" +
            "1234\r\n" +
            "------=_20090529115303_60479--\r\n";

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             Assert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

             Utilities.AssertMessageExistsInFolder(account.IMAPFolders[0], 1);

             IMAPSimulator oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

             Assert.IsTrue(result.Contains("(\"NAME\" \"=?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\")"));
             Assert.IsTrue(result.Contains("(\"FILENAME\" \"=?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\")"));
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:44,代码来源:IMAP.cs

示例6: TestBodyStructureWithNonLatinCharacterInAttachmentHeader

        public void TestBodyStructureWithNonLatinCharacterInAttachmentHeader()
        {
            string @messageText =
            "From: \"Test\" <[email protected]>"+ "\r\n" +
            "To: \"Test\" <[email protected]>" + "\r\n" +
            "Subject: test" + "\r\n" +
            "MIME-Version: 1.0" + "\r\n" +
            "Content-Type: multipart/mixed;" + "\r\n" +
            "   boundary=\"----=_NextPart_000_000C_01C9EEB2.08D2EC80\"" + "\r\n" +
            "X-Priority: 3" + "\r\n" +
            "" + "\r\n" +
            "This is a multi-part message in MIME format." + "\r\n" +
            "" + "\r\n" +
            "------=_NextPart_000_000C_01C9EEB2.08D2EC80" + "\r\n" +
            "Content-Type: text/plain;" + "\r\n" +
            "  format=flowed;" + "\r\n" +
            "	charset=\"iso-8859-1\";" + "\r\n" +
            "	reply-type=original" + "\r\n" +
            "Content-Transfer-Encoding: 7bit" + "\r\n" +
            "" + "\r\n" +
            "" + "\r\n" +
            "------=_NextPart_000_000C_01C9EEB2.08D2EC80" + "\r\n" +
            "Content-Type: application/octet-stream;" + "\r\n" +
            "	name=\"=?iso-8859-1?B?beT2LnppcA==?=\"" + "\r\n" +
            "Content-Transfer-Encoding: base64" + "\r\n" +
            "Content-Disposition: attachment;" + "\r\n" +
            "	filename=\"=?iso-8859-1?B?beT2LnppcA==?=\"" + "\r\n" +
            "" + "\r\n" +
            "iVBORw0KGgoAAAANSUhEUgAAAqgAAAH4CAIAAAAJvIhhAAAAAXNSR0IArs4c6QAAAARnQU1BAACx" + "\r\n" +
            "uIDgj5MrSIAAAQIEzgkI/nP2KhMgQIAAgbiA4I+TK0iAAAECBM4JCP5z9ioTIECAAIG4wP8ChvJS" + "\r\n" +
            "wXUaKVoAAAAASUVORK5CYII=" + "\r\n" +
            "" + "\r\n" +
            "------=_NextPart_000_000C_01C9EEB2.08D2EC80--" + "\r\n";

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             Assert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

             Utilities.AssertMessageExistsInFolder(account.IMAPFolders[0], 1);

             IMAPSimulator oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

             Assert.IsTrue(result.Contains("(\"NAME\" \"=?iso-8859-1?B?beT2LnppcA==?=\")"));
             Assert.IsTrue(result.Contains("(\"FILENAME\" \"=?iso-8859-1?B?beT2LnppcA==?=\")"));

             string fileName = account.IMAPFolders.get_ItemByName("INBOX").Messages[0].Attachments[0].Filename;
             Assert.AreEqual("mäö.zip", fileName);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:52,代码来源:IMAP.cs

示例7: TestBeforeLogon

        public void TestBeforeLogon()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

              IMAPSimulator oSimulator = new IMAPSimulator();

              string sWelcomeMessage = oSimulator.Connect();

              Assert.IsTrue(oSimulator.ExamineFolder("NonexistantFolder").Contains("NO Authenticate first"));
              Assert.IsFalse(oSimulator.SelectFolder("NonexistantFolder"));
              Assert.IsFalse(oSimulator.Copy(1, "SomeFolder"));
              Assert.IsFalse(oSimulator.CheckFolder("SomeFolder"));
              Assert.IsTrue(oSimulator.Fetch("123 a").Contains("NO Authenticate first"));
              Assert.IsTrue(oSimulator.List().Contains("NO Authenticate first"));
              Assert.IsTrue(oSimulator.LSUB().Contains("NO Authenticate first"));
              Assert.IsTrue(oSimulator.GetMyRights("APA").Contains("NO Authenticate first"));
              Assert.IsFalse(oSimulator.RenameFolder("A", "B"));
              Assert.IsFalse(oSimulator.Status("SomeFolder", "MESSAGES").Contains("A01 OK"));
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:19,代码来源:IMAP.cs

示例8: TestUnseenResponseInSelect

        public void TestUnseenResponseInSelect()
        {
            hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestMessage");

             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);

             IMAPSimulator sim = new IMAPSimulator();
             Assert.IsTrue(sim.ConnectAndLogon(account.Address, "test"));
             Assert.IsTrue(sim.SelectFolder("Inbox"));
             Assert.IsTrue(sim.CreateFolder("Dummy"));
             Assert.IsTrue(sim.Copy(1, "Dummy"));

             string result = sim.SendSingleCommand("a01 select Dummy");
             Assert.IsTrue(result.Contains("* 1 EXISTS\r\n* 1 RECENT"), result);

             string searchResponse = sim.SendSingleCommand("srch1 SEARCH ALL UNSEEN");

             // We should have at least one message here.
             Assert.IsTrue(searchResponse.Contains("* SEARCH 1\r\n"), searchResponse);

             // Now fetch the body.
             string bodyText = sim.Fetch("1 BODY[TEXT]");

             // Now the message is no longer unseen. Confirm this.
             searchResponse = sim.SendSingleCommand("srch1 SEARCH ALL UNSEEN");
             Assert.IsTrue(searchResponse.Contains("* SEARCH\r\n"), searchResponse);

             // Close the messages to mark them as no longer recent.
             Assert.IsTrue(sim.Close());

             result = sim.SendSingleCommand("a01 select Dummy");
             Assert.IsTrue(result.Contains("* 1 EXISTS\r\n* 0 RECENT"), result);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:35,代码来源:IMAP.cs


注:本文中的IMAPSimulator.Fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。