本文整理汇总了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;未经允许,请勿转载。 |
请发表评论