public void TestFetch() { hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody1"); IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1); SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody2"); IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 2); SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody3"); IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 3); IMAPSimulator sim = new IMAPSimulator(); sim.ConnectAndLogon(account.Address, "test"); sim.SelectFolder("INBOX"); string result = sim.Fetch("1 BODY[1]"); Assert.IsTrue(result.Contains("SampleBody1"), result); result = sim.Fetch("2 BODY[1]"); Assert.IsTrue(result.Contains("SampleBody2"), result); result = sim.Fetch("3 BODY[1]"); Assert.IsTrue(result.Contains("SampleBody3"), result); }
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, "*****@*****.**", "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(); }
public void TestChangeSeenFlag() { hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); Assert.IsTrue(SMTPClientSimulator.StaticSend("*****@*****.**", oAccount.Address, "Test", "test")); POP3Simulator.AssertMessageCount(oAccount.Address, "test", 1); IMAPSimulator simulator = new IMAPSimulator(); simulator.ConnectAndLogon(oAccount.Address, "test"); simulator.ExamineFolder("Inbox"); string flags = simulator.GetFlags(1); string body = simulator.Fetch("1 RFC822"); string flagsAfter = simulator.GetFlags(1); simulator.Close(); simulator.Disconnect(); Assert.AreEqual(flags, flagsAfter); IMAPSimulator secondSimulator = new IMAPSimulator(); secondSimulator.ConnectAndLogon(oAccount.Address, "test"); secondSimulator.SelectFolder("Inbox"); string secondFlags = secondSimulator.GetFlags(1); string secondBody = secondSimulator.Fetch("1 RFC822"); string secondFlagsAfter = secondSimulator.GetFlags(1); secondSimulator.Close(); secondSimulator.Disconnect(); Assert.AreNotEqual(secondFlags, secondFlagsAfter); }
public void TestBodyStructureWithNonLatinCharacter() { hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); string attachmentName = "本本本.zip"; string filename = Path.Combine(Path.GetTempPath(), attachmentName); File.WriteAllText(filename, "tjena moss"); hMailServer.Message message = new hMailServer.Message(); message.Charset = "utf-8"; message.AddRecipient("test", account.Address); message.From = "Test"; message.FromAddress = account.Address; message.Body = "hejsan"; message.Attachments.Add(filename); message.Save(); 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(); // utf-8 representation of 本本本.zip: Assert.IsTrue(result.Contains("=?utf-8?B?5pys5pys5pys?=.zip")); }
public void TestFetchEnvelopeWithDateContainingQuote() { hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); string message = "From: Someone <*****@*****.**>" + Environment.NewLine + "To: Someoen <*****@*****.**>" + Environment.NewLine + "Date: Wed, 22 Apr 2009 11:05:09 \"GMT\"" + Environment.NewLine + "Subject: Something" + Environment.NewLine + Environment.NewLine + "Hello" + Environment.NewLine; SMTPClientSimulator smtpSimulator = new SMTPClientSimulator(); smtpSimulator.SendRaw(account.Address, account.Address, message); POP3Simulator.AssertMessageCount(account.Address, "test", 1); IMAPSimulator oSimulator = new IMAPSimulator(); string sWelcomeMessage = oSimulator.Connect(); oSimulator.Logon(account.Address, "test"); oSimulator.SelectFolder("INBOX"); string result = oSimulator.Fetch("1 ENVELOPE"); oSimulator.Disconnect(); Assert.IsTrue(result.Contains("Wed, 22 Apr 2009 11:05:09 GMT")); }
public void TestFetchHeaderFieldsNot() { hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); string message = "From: Someone <*****@*****.**>" + Environment.NewLine + "To: Someoen <*****@*****.**>" + Environment.NewLine + "Date: Wed, 22 Apr 2009 11:05:09 \"GMT\"" + Environment.NewLine + "Subject: Something" + Environment.NewLine + Environment.NewLine + "Hello" + Environment.NewLine; SMTPClientSimulator smtpSimulator = new SMTPClientSimulator(); Assert.IsTrue(smtpSimulator.SendRaw(account.Address, account.Address, message)); POP3Simulator.AssertMessageCount(account.Address, "test", 1); IMAPSimulator oSimulator = new IMAPSimulator(); string sWelcomeMessage = oSimulator.Connect(); oSimulator.Logon(account.Address, "test"); oSimulator.SelectFolder("INBOX"); string result = oSimulator.Fetch("1 BODY.PEEK[HEADER.FIELDS.NOT (Subject From)]"); oSimulator.Disconnect(); Assert.IsTrue(result.Contains("Received:"), result); Assert.IsFalse(result.Contains("Subject:"), result); Assert.IsFalse(result.Contains("From:"), result); // The feedback should end with an empty header line. Assert.IsTrue(result.Contains("\r\n\r\n)"), result); }
public void TestFetchInvalid() { hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody1"); SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody2"); SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody3"); IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 3); IMAPSimulator sim = new IMAPSimulator(); sim.ConnectAndLogon(account.Address, "test"); sim.SelectFolder("INBOX"); string result = sim.Fetch("0 BODY[1]"); Assert.IsTrue(result.StartsWith("A01 OK FETCH completed")); result = sim.Fetch("-1 BODY[1]"); Assert.IsTrue(result.StartsWith("A01 BAD")); result = sim.Fetch("-100 BODY[1]"); Assert.IsTrue(result.StartsWith("A01 BAD")); }
public void TestParseMultipartNoBody() { hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); string body = Utilities.GetResource("Messages.MultipartMessageWithNoMainBodyText.txt"); SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, body); POP3Simulator.AssertMessageCount(account.Address, "test", 1); var imapSim = new IMAPSimulator("*****@*****.**", "test", "INBOX"); var result = imapSim.Fetch("1 (BODY.PEEK[HEADER] BODY.PEEK[TEXT])"); imapSim.Logout(); }
public void TestFetchCharsetInQuotesWithoutSpace() { hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "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); }
public void TestFetchCharsetInQuotesWithoutQuotesWithSpace() { hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "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); }
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: <*****@*****.**>\r\n" + "To: <*****@*****.**>\r\n" + "Subject: sdafsda\r\n" + "Message-ID: <96aee740f2abe8450648c1752a9a987b@localhost>\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, "*****@*****.**", "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); }
public void TestBeforeLogon() { hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "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")); }
public void TestUnseenResponseInSelect() { hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "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); }
public void TestBodyStructureWithNonLatinCharacterInAttachmentHeader() { string @messageText = "From: \"Test\" <*****@*****.**>"+ "\r\n" + "To: \"Test\" <*****@*****.**>" + "\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, "*****@*****.**", "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); }
public void TestCopyMessage() { hMailServer.Application app = SingletonProvider <Utilities> .Instance.GetApp(); hMailServer.Utilities utilities = app.Utilities; hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); // Create a new folder. hMailServer.IMAPFolder folder = account.IMAPFolders.get_ItemByName("INBOX"); folder.Save(); hMailServer.IMAPFolder someOtherFolder = account.IMAPFolders.Add("SomeOtherFolder"); for (int i = 0; i < 3; i++) { hMailServer.Message message = folder.Messages.Add(); message.set_Flag(hMailServer.eMessageFlag.eMFSeen, true); message.Save(); message.Copy(someOtherFolder.ID); } SMTPClientSimulator.StaticSend("*****@*****.**", account.Address, "Test", "Test"); // Copy back to inbox. for (int i = 0; i < 3; i++) { hMailServer.Message message = someOtherFolder.Messages[i]; message.Copy(folder.ID); } POP3Simulator.AssertMessageCount(account.Address, "test", 7); IMAPSimulator sim = new IMAPSimulator(); sim.ConnectAndLogon(account.Address, "test"); sim.SelectFolder("Inbox"); string response = sim.Fetch("1:7 UID"); string[] lines = Microsoft.VisualBasic.Strings.Split(response, Environment.NewLine, -1, Microsoft.VisualBasic.CompareMethod.Text); List <string> uids = new List <string>(); foreach (string line in lines) { int paraPos = line.IndexOf("("); int paraEndPos = line.IndexOf(")"); if (paraPos < 0 || paraEndPos < 0) { continue; } string paraContent = line.Substring(paraPos + 1, paraEndPos - paraPos - 1); if (!uids.Contains(paraContent)) { uids.Add(paraContent); } } Assert.AreEqual(7, uids.Count); // Make sure the UIDS are sorted properly by creating a copy, sort the copy // and then compare to original. List <string> copy = new List <string>(); copy.InsertRange(0, uids); copy.Sort(); Assert.AreEqual(copy, uids); }
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, "*****@*****.**", "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(); }
public void TestBodyStructureWithNonLatinCharacterSingleLineEncoded() { string @messageText = "Message-ID: <1d11306c5648497247447e1073c3b0e2.squirrel@www.*******.**>\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, "*****@*****.**", "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?=\")")); }
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, "*****@*****.**", "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?=\"")); }