• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Tasks.MailTask类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NAnt.Core.Tasks.MailTask的典型用法代码示例。如果您正苦于以下问题:C# MailTask类的具体用法?C# MailTask怎么用?C# MailTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MailTask类属于NAnt.Core.Tasks命名空间,在下文中一共展示了MailTask类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: testAllLists

        public void testAllLists()
        {
            MailTask mailTask = new MailTask();
            mailTask.Project = new Project();

            _tolist= _emailAddress1;
            _cclist= _emailAddress2;
            _bcclist= _emailAddress1;
            _subject="Msg 5: Test to all addresses";
            _message="Test message";

            try {
                mailTask.Mailhost = _mailhost;
                mailTask.From = _from;
                mailTask.ToList = _tolist;
                mailTask.Subject = _subject;
                mailTask.Message = _message;
                mailTask.CcList = _cclist;
                mailTask.BccList = _bcclist;
                mailTask.Attachments = _attachments;
                mailTask.Files = _files;

                mailTask.Execute();
            } catch (Exception e) {
                Assertion.Assert(_subject + ": " + e.Message, false);
            }
        }
开发者ID:skolima,项目名称:NAnt,代码行数:27,代码来源:MailTaskTest.cs


示例2: MixedEmailFormatTest

        public void MixedEmailFormatTest()
        {
            string methodName = "MixedEmailFormatTest()";
            string[] toEmails = new string[]
            {
                CreateEmailListString(_twoEmails),
                CreateEmailListString(_twoAngleBracketsNameEmails),
                CreateEmailListString(_twoParenthesisEmailNames),
                CreateEmailListString(_twoAngleBracketsEmailNames),
                CreateEmailListString(_twoParenthesisNameEmails)
            };

            MailTask mailTask = new MailTask();
            mailTask.Project = CreateEmptyProject();

            mailTask.Mailhost = _mailHost;
            mailTask.Port = _port;
            mailTask.From = _fromEmail;
            mailTask.ToList = CreateEmailListString(toEmails);
            mailTask.Subject = String.Format(_subjectText, methodName);
            mailTask.Message = CreateSampleEmailMessage(methodName);

            mailTask.Execute();

            Assert.AreEqual(1, _smtpServer.ReceivedEmailCount);
            Assert.AreEqual(10, _smtpServer.ReceivedEmail[0].ToAddresses.Length);
        }
开发者ID:JayBeard,项目名称:nant,代码行数:27,代码来源:MailTaskTest.cs


示例3: ManyToNamesAndEmailAddressesInParenthesisTest

        public void ManyToNamesAndEmailAddressesInParenthesisTest()
        {
            string methodName = "ManyToNamesAndEmailAddressesInParenthesisTest()";

            MailTask mailTask = new MailTask();
            mailTask.Project = CreateEmptyProject();

            mailTask.Mailhost = _mailHost;
            mailTask.Port = _port;
            mailTask.From = _fromEmail;
            mailTask.ToList = CreateEmailListString(_multiParenthesisNameEmails);
            mailTask.Subject = String.Format(_subjectText, methodName);
            mailTask.Message = CreateSampleEmailMessage(methodName);

            mailTask.Execute();

            Assert.AreEqual(1, _smtpServer.ReceivedEmailCount);
            Assert.AreEqual(6, _smtpServer.ReceivedEmail[0].ToAddresses.Length);
        }
开发者ID:JayBeard,项目名称:nant,代码行数:19,代码来源:MailTaskTest.cs


示例4: ManyCcNamesAndEmailAddressesInParenthesisTest

        public void ManyCcNamesAndEmailAddressesInParenthesisTest()
        {
            string methodName = "ManyCcNamesAndEmailAddressesInParenthesisTest()";

            MailTask mailTask = new MailTask();
            mailTask.Project = CreateEmptyProject();

            mailTask.Mailhost = _mailHost;
            mailTask.Port = _port;
            mailTask.From = _fromEmail;
            mailTask.CcList = CreateEmailListString(_multiParenthesisNameEmails);
            mailTask.Subject = String.Format(_subjectText, methodName);
            mailTask.Message = CreateSampleEmailMessage(methodName);

            mailTask.Execute();

            Assert.AreEqual(1, _smtpServer.ReceivedEmailCount);

            if (_smtpServer.ReceivedEmail[0].Headers.ContainsKey("Cc"))
            {
                string[] ccEmails = GetCcAddressesFromSentMail();

                Assert.AreEqual(6, ccEmails.Length);
            }
            else
            {
                Assert.Fail("Test email did not contain addresses in the CC line");
            }
        }
开发者ID:JayBeard,项目名称:nant,代码行数:29,代码来源:MailTaskTest.cs


示例5: EmailMessageFromFileTest

        public void EmailMessageFromFileTest()
        {
            string methodName = "EmailMessageFromFileTest()";
            FileSet fileSet = new FileSet();
            fileSet.FileNames.AddRange(_files.ToArray());

            MailTask mailTask = new MailTask();
            mailTask.Project = CreateEmptyProject();

            mailTask.Mailhost = _mailHost;
            mailTask.Port = _port;
            mailTask.From = _fromEmail;
            mailTask.ToList = CreateEmailListString(_twoEmails);
            mailTask.Subject = String.Format(_subjectText, methodName);
            mailTask.Files = fileSet;

            mailTask.Execute();

            Assert.AreEqual(1, _smtpServer.ReceivedEmailCount);
        }
开发者ID:JayBeard,项目名称:nant,代码行数:20,代码来源:MailTaskTest.cs


示例6: BadParenthesisNameEmailTest

        public void BadParenthesisNameEmailTest()
        {
            string methodName = "BadParenthesisNameEmailTest()";

            MailTask mailTask = new MailTask();
            mailTask.Project = CreateEmptyProject();

            mailTask.Mailhost = _mailHost;
            mailTask.Port = _port;
            mailTask.From = _fromEmail;
            mailTask.ToList = _badParenthesisNameEmail;
            mailTask.Subject = String.Format(_subjectText, methodName);
            mailTask.Message = CreateSampleEmailMessage(methodName);

            mailTask.Execute();
        }
开发者ID:JayBeard,项目名称:nant,代码行数:16,代码来源:MailTaskTest.cs


示例7: AllRecipientListsTest

        public void AllRecipientListsTest()
        {
            string methodName = "AllRecipientListsTest()";

            MailTask mailTask = new MailTask();
            mailTask.Project = CreateEmptyProject();

            mailTask.Mailhost = _mailHost;
            mailTask.Port = _port;
            mailTask.From = _fromEmail;
            mailTask.ToList = CreateEmailListString(_twoEmails);
            mailTask.CcList = CreateEmailListString(_twoParenthesisEmailNames);
            mailTask.BccList = CreateEmailListString(_twoAngleBracketsNameEmails);
            mailTask.Subject = String.Format(_subjectText, methodName);
            mailTask.Message = CreateSampleEmailMessage(methodName);

            mailTask.Execute();

            Assert.AreEqual(1, _smtpServer.ReceivedEmailCount);
            Assert.AreEqual(6, _smtpServer.ReceivedEmail[0].ToAddresses.Length);
            Assert.AreEqual(2, GetCcAddressesFromSentMail().Length);
        }
开发者ID:JayBeard,项目名称:nant,代码行数:22,代码来源:MailTaskTest.cs


示例8: TwoToEmailAddressesAndNamesInAngleBracketsTest

        public void TwoToEmailAddressesAndNamesInAngleBracketsTest()
        {
            string methodName = "TwoToEmailAddressesAndNamesInAngleBracketsTest()";

            MailTask mailTask = new MailTask();
            mailTask.Project = CreateEmptyProject();

            mailTask.Mailhost = _mailHost;
            mailTask.Port = _port;
            mailTask.From = _fromEmail;
            mailTask.ToList = CreateEmailListString(_twoAngleBracketsEmailNames);
            mailTask.Subject = String.Format(_subjectText, methodName);
            mailTask.Message = CreateSampleEmailMessage(methodName);

            mailTask.Execute();

            Assert.AreEqual(1, _smtpServer.ReceivedEmailCount);
            Assert.AreEqual(2, _smtpServer.ReceivedEmail[0].ToAddresses.Length);
        }
开发者ID:JayBeard,项目名称:nant,代码行数:19,代码来源:MailTaskTest.cs


示例9: SimpleNameEmailWithParenthesisTest

        public void SimpleNameEmailWithParenthesisTest()
        {
            string methodName = "SimpleNameEmailWithParenthesisTest()";

            MailTask mailTask = new MailTask();
            mailTask.Project = CreateEmptyProject();

            mailTask.Mailhost = _mailHost;
            mailTask.Port = _port;
            mailTask.From = _fromEmail;
            mailTask.ToList = _singleParenthesisNameEmail;
            mailTask.Subject = String.Format(_subjectText, methodName);
            mailTask.Message = CreateSampleEmailMessage(methodName);

            mailTask.Execute();

            Assert.AreEqual(1, _smtpServer.ReceivedEmailCount);
        }
开发者ID:JayBeard,项目名称:nant,代码行数:18,代码来源:MailTaskTest.cs


示例10: testFilesAsBody

        public void testFilesAsBody()
        {
            MailTask mailTask = new MailTask();
            mailTask.Project = new Project();

            _tolist= _emailAddress1;
            _subject="Msg 6: Files for message";
            _message="Test message";
            foreach (string fileName in _fileList) {
                _files += fileName + ";";
            }
            // add bogus entry
            _files += "BogusFile.txt";

            try {
                mailTask.Mailhost = _mailhost;
                mailTask.From = _from;
                mailTask.ToList = _tolist;
                mailTask.Subject = _subject;
                mailTask.Message = _message;
                mailTask.CcList = _cclist;
                mailTask.BccList = _bcclist;
                mailTask.Attachments = _attachments;
                mailTask.Files = _files;

                mailTask.Execute();
            } catch (Exception e) {
                Assertion.Assert(_subject + ": " + e.Message, false);
            }
        }
开发者ID:skolima,项目名称:NAnt,代码行数:30,代码来源:MailTaskTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# VSNet.Configuration类代码示例发布时间:2022-05-26
下一篇:
C# Core.PropertyDictionary类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap