本文整理汇总了C#中NAnt.Core.Tasks.MailTask.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# MailTask.Execute方法的具体用法?C# MailTask.Execute怎么用?C# MailTask.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NAnt.Core.Tasks.MailTask
的用法示例。
在下文中一共展示了MailTask.Execute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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");
}
}
示例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);
}
示例4: 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();
}
示例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);
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
}
示例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);
}
}