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


C# SMTPClientSimulator.SendRaw方法代码示例

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


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

示例1: TestLongLineInData

        public void TestLongLineInData()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
             var sb = new StringBuilder();
             for (int i = 0; i < 11000; i++)
             {
            sb.Append("1234567890");
             }

             var sim = new SMTPClientSimulator();
             Assert.IsFalse(sim.SendRaw("[email protected]", "[email protected]", sb.ToString()));
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:12,代码来源:ContentStressTest.cs

示例2: TestOverlappingBoundaryNames

        public void TestOverlappingBoundaryNames()
        {
            string content = "Return-Path: <[email protected]>\r\n" +
                          "From: \"test\" <[email protected]>\r\n" +
                          "To: \"Test\" <[email protected]>\r\n" +
                          "Subject: rtest\r\n" +
                          "Date: Thu, 22 Jan 2009 13:20:32 +0100\r\n" +
                          "MIME-Version: 1.0\r\n" +
                          "Content-Type: multipart/mixed;\r\n" +
                          "    boundary=\"----=_NextPart_000_000D_01C97C94.33D5E670\"\r\n" +
                          "\r\n" +
                          "This is a multi-part message in MIME format.\r\n" +
                          "\r\n" +
                          "------=_NextPart_000_000D_01C97C94.33D5E670\r\n" +
                          "Content-Type: multipart/alternative;\r\n" +
                          "    boundary=\"----=_NextPart_000_000D_01C97C94.33D5E670.ALT\"\r\n" +
                          "\r\n" +
                          "\r\n" +
                          "------=_NextPart_000_000D_01C97C94.33D5E670.ALT\r\n" +
                          "Content-Type: text/plain;\r\n" +
                          "    charset=\"iso-8859-1\"\r\n" +
                          "Content-Transfer-Encoding: quoted-printable\r\n" +
                          "\r\n" +
                          "test\r\n" +
                          "------=_NextPart_000_000D_01C97C94.33D5E670.ALT\r\n" +
                          "Content-Type: text/html;\r\n" +
                          "    charset=\"iso-8859-1\"\r\n" +
                          "Content-Transfer-Encoding: quoted-printable\r\n" +
                          "\r\n" +
                          "<a>test</a>\r\n" +
                          "\r\n" +
                          "------=_NextPart_000_000D_01C97C94.33D5E670.ALT--\r\n" +
                          "\r\n" +
                          "------=_NextPart_000_000D_01C97C94.33D5E670\r\n" +
                          "Content-Type: application/octet-stream;\r\n" +
                          "    name=\"test.vbs\"\r\n" +
                          "Content-Transfer-Encoding: 7bit\r\n" +
                          "Content-Disposition: attachment;\r\n" +
                          "    filename=\"test.vbs\"\r\n" +
                          "\r\n" +
                          "s = \"abc\"\r\n" +
                          "\r\n" +
                          "msgbox mid(s,1,100000)\r\n" +
                          "------=_NextPart_000_000D_01C97C94.33D5E670--\r\n" +
                          "\r\n" +
                          "";

             // Add an account
             Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");

             Rule oRule = oAccount.Rules.Add();
             oRule.Name = "Criteria test";
             oRule.Active = true;

             RuleCriteria oRuleCriteria = oRule.Criterias.Add();
             oRuleCriteria.UsePredefined = false;
             oRuleCriteria.HeaderField = "Subject";
             oRuleCriteria.MatchType = eRuleMatchType.eMTContains;
             oRuleCriteria.MatchValue = "rtest";
             oRuleCriteria.Save();

             // Add action
             RuleAction oRuleAction = oRule.Actions.Add();
             oRuleAction.Type = eRuleActionType.eRASetHeaderValue;
             oRuleAction.HeaderName = "SomeHeader";
             oRuleAction.Value = "SomeValue";
             oRuleAction.Save();

             // Save the rule in the database
             oRule.Save();

             var oSMTP = new SMTPClientSimulator();

             // Spam folder
             oSMTP.SendRaw("[email protected]", "[email protected]", content);

             string sContents = POP3Simulator.AssertGetFirstMessageText("[email protected]", "test");

             Assert.IsTrue(sContents.IndexOf("SomeHeader: SomeValue") > 0);
             Assert.IsTrue(sContents.IndexOf("------=_NextPart_000_000D_01C97C94.33D5E670.ALT--") > 0);
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:81,代码来源:ContentStressTest.cs

示例3: CriteriaContainsHTMLBody

        public void CriteriaContainsHTMLBody()
        {
            // Add an account
             Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");

             Rule oRule = account.Rules.Add();
             oRule.Name = "Criteria test";
             oRule.Active = true;

             RuleCriteria oRuleCriteria = oRule.Criterias.Add();
             oRuleCriteria.UsePredefined = true;
             oRuleCriteria.PredefinedField = eRulePredefinedField.eFTBody;
             oRuleCriteria.MatchType = eRuleMatchType.eMTContains;
             oRuleCriteria.MatchValue = "MyHTMLBody";
             oRuleCriteria.Save();

             // Add action
             RuleAction oRuleAction = oRule.Actions.Add();
             oRuleAction.Type = eRuleActionType.eRAMoveToImapFolder;
             oRuleAction.IMAPFolder = "INBOX.Wildcard";
             oRuleAction.Save();

             // Save the rule in the database
             oRule.Save();

             var oSMTP = new SMTPClientSimulator();

             string message = "From: Someone <[email protected]>" + Environment.NewLine +
                          "Content-Type: text/html; charset=\"Windows-1251\"" + Environment.NewLine +
                          "Content-Transfer-Encoding: quoted-printable" + Environment.NewLine +
                          Environment.NewLine +
                          "<HTML><Center>MyHTMLBody</Center></HTML>" + Environment.NewLine;

             oSMTP.SendRaw("[email protected]", account.Address, message);

             // The message should be placed in the Wildcard folder, since the HTML body of the message contains MyHTMLBody.
             IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox.Wildcard", 1);
             IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 0);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:39,代码来源:Rules.cs

示例4: TestFetchHeaderFieldsNot

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

             string message = "From: Someone <[email protected]>" + Environment.NewLine +
                          "To: Someoen <[email protected]>" + Environment.NewLine +
                          "Date: Wed, 22 Apr 2009 11:05:09 \"GMT\"" + Environment.NewLine +
                          "Subject: Something" + Environment.NewLine +
                          Environment.NewLine +
                          "Hello" + Environment.NewLine;

             var smtpSimulator = new SMTPClientSimulator();
             Assert.IsTrue(smtpSimulator.SendRaw(account.Address, account.Address, message));

             POP3Simulator.AssertMessageCount(account.Address, "test", 1);

             var 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);
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:29,代码来源:Fetch.cs

示例5: TestFetchEnvelopeWithDateContainingQuote

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

             string message = "From: Someone <[email protected]>" + Environment.NewLine +
                          "To: Someoen <[email protected]>" + Environment.NewLine +
                          "Date: Wed, 22 Apr 2009 11:05:09 \"GMT\"" + Environment.NewLine +
                          "Subject: Something" + Environment.NewLine +
                          Environment.NewLine +
                          "Hello" + Environment.NewLine;

             var smtpSimulator = new SMTPClientSimulator();
             smtpSimulator.SendRaw(account.Address, account.Address, message);

             POP3Simulator.AssertMessageCount(account.Address, "test", 1);

             var 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"));
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:25,代码来源:Fetch.cs

示例6: StaticSendRaw

 public static bool StaticSendRaw(string sFrom, string recipient, string sBody)
 {
     var oSimulator = new SMTPClientSimulator();
      return oSimulator.SendRaw(sFrom, recipient, sBody);
 }
开发者ID:japi,项目名称:hmailserver,代码行数:5,代码来源:SMTPClientSimulator.cs


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