我必须用多个抄送地址发送邮件。目前此代码仅适用于一个。这是代码:MailAddress addressTo = new MailAddress("ma@.asd.a"); MailAddress addressFrom = new MailAddress("ma@.asd.a"); MailMessage MyMessage = new MailMessage("ma@.asd.a", "ma@.asd.a"); MyMessage.Subject = "New requests"; MyMessage.Body = @"Body"; MailAddress copy = new MailAddress("ma@.asd.a"); MyMessage.CC.Add(copy); SmtpClient client = new SmtpClient(); client.Port = 32; client.EnableSsl = false; client.Host = "my-smtp"; client.Timeout = 10000; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.Credentials = new System.Net.NetworkCredential(LocalUserName, ""); client.UseDefaultCredentials = false; client.Send(MyMessage);我已经绑了这个:MailAddress copy2 = new MailAddress("maas@.asd.a"); MyMessage.CC.Add(copy2)但它不起作用请求有超时错误。有人可以帮我弄这个吗 ?
1 回答
慕森王
TA贡献1777条经验 获得超3个赞
只需单独添加它们:
MyMessage.CC.Add("a@a.com");
或者添加多个作为 AddRange:
MyMessage.CC.AddRange("a@a.com", "b@b.com");
- 1 回答
- 0 关注
- 354 浏览
添加回答
举报
0/150
提交
取消