MailMessage mailMessage = new MailMessage();
mailMessage.From = this._from;
if (isBulkprintDate == true || isDeliveryDate == true || isCreateWorkOrderInfo == true)
{
mailMessage.To = "emilypei@toppanleefung.com";
}
if (isBulkprintDate == true || isDeliveryDate == true)
{
if (location == "H")
{
mailMessage.To = "elevenzeng@toppanleefung.com";
}
else if (location =="S")
{
mailMessage.To = "emilypei@toppanleefung.com";
}
}
if (isBulkprintDate == true)
{
if (teamA == true || teamB == true)
{
//mailMessage.To = "sz-ttn@toppanleefung.com";
mailMessage.To = "emilypei@toppanleefung.com";
}
else if (teamC == true)
{
//mailMessage.To = "vite-hkttn@toppanleefung.com";
mailMessage.To = "emilypei@toppanleefung.com";
}
}
mailMessage.Cc = this._cc;
mailMessage.Subject = "[Job Name] – Change in Bulk Print Date/Delivery Date ";
mailMessage.Body = mailBody.ToString().Replace("{workOrderID}", workOrderID).Replace("{companyName}", companyName).Replace("{jobName}", jobName).Replace("{jobFounction}", jobFounction).Replace("{bulkPrintDate}", bulkPrintDate).Replace("{deliveryDate}", deliveryDate).Replace("{sales}", sales).Replace("{updateBy}", updateBy).Replace("{updateDate}", updateDate);
mailMessage.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = this._smtp_server;
SmtpMail.Send(mailMessage);
return true;
怎么讲这段代码循环 发送
用一个数组来存放所以收件人的address.
然后循环该数组取address。如果还有其它条件,可以这样:
Dictioary<key, address list> :key可以用来特定群组。address list即该群组所有email address
我的地址是通过判断的出来的不知道怎么写 高人帮忙我那个代码写写 写写
@Emliy.pei:
用这个,Dictioary<key, address list> :key可以用来特定群组。address list即该群组所有email address
你先归好类。比如:
if (location == "H")
{
mailMessage.To = "elevenzeng@toppanleefung.com";
}
对应:
key: H
address: "elevenzeng@toppanleefung.com"
@Repository: 这个可以键值对 其他的几个值似乎不可以哦。。
@Emliy.pei:
写程序讲究变通。其它几个也可以这样处理。
@Repository: 除了这个能有其他方法吗
@Emliy.pei: 在求助 应该会有更加简便的方法