本文整理汇总了C#中ActiveUp.Net.Mail.Message.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Message.Clone方法的具体用法?C# Message.Clone怎么用?C# Message.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveUp.Net.Mail.Message
的用法示例。
在下文中一共展示了Message.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeCollection
/// <summary>
/// Create a collection of message based on the merging of the message and a datasource.
/// </summary>
/// <param name="message">The message to use as a base for merging.</param>
/// <param name="dataSource">The datasource to use for merging.</param>
/// <param name="send">Specify if you want to send the message when merged.</param>
/// <returns>The merged MessageCollection.</returns>
public MessageCollection MergeCollection(Message message, object dataSource, bool send)
{
MessageCollection messages = new MessageCollection();
if (dataSource.GetType().ToString() == "System.Data.DataSet")
dataSource = ((System.Data.DataSet)dataSource).Tables[0];
IEnumerator items = GetEnumerator(dataSource);
// Determine max
int total = 0;//, messageNumber = 0, messageSent = 0;
while(items.MoveNext())
total++;
items.Reset();
if (items != null)
{
while(items.MoveNext())
{
Message newMessage = message.Clone();
this.MergeMessage(newMessage, items.Current);
messages.Add(newMessage);
/*string file = @"c:\temp\_amail_\test.eml";
if (File.Exists(file))
File.Delete(file);
newMessage.StoreToFile(file);*/
if (send)
{
if (this.SmtpServers.Count > 0)
{
//newMessage.Send(this.SmtpServers);
SmtpClient.Send(newMessage, this.SmtpServers);
}
else
{
//newMessage.DirectSend();
SmtpClient.DirectSend(newMessage);
}
}
}
ActiveUp.Net.Mail.Logger.AddEntry("Message created successfully.", 2);
}
return messages;
}