我有一个List<EMailData>
,其中包含&#39; n&#39;电子邮件,内容和附件的数量。
我使用循环列表来发送电子邮件及其花费时间。
有没有办法在更短的时间内发送多封电子邮件?
类EMailData
具有EmailID,EMailContent和Attachment作为属性
private void SendEmail() {
for(int i=0; i<objlstEmailData.Count; i++) {
List<System.Net.Mail.Attachment> lstAttachment = new List<System.Net.Mail.Attachment>();
System.Net.Mail.Attachment att = new System.Net.Mail.Attachment(new System.IO.MemoryStream(objlstEmailData[i].EmailAttachment), "Invoice.pdf");
lstAttachment.Add(att);
DotNetNuke.Services.Mail.Mail.SendEmail(fromEmail, fromEmail, objlstEmailData[i].EmailId, "Inovice - XXX", objlstEmailData[i].EmailData, lstAttachment);
}
}