我在我的网络应用程序中发送多封电子邮件时遇到问题。如果我只发送到一个地址,它会正常发送!
我的字符串列表是正确的,因为如果我粘贴到 Outlook 中并手动发送,所有地址都会收到。
嗯,这是我的字符串 listEmail 有一个值“caio.jesus@ex.com”,我收到了。如果字符串 listEmail 的值为“caio.jesus@ex.com; raul@ex.com; mat@ex.com;” 没有人收到。
lstEmail.ToList();
string listEmail = string.Join("; ", lstEmail.ToArray());
System.Net.Mail.MailMessage objEmail = new System.Net.Mail.MailMessage();
objEmail.From = new MailAddress("caio.jesus@ex.com", "BR");
objEmail.To.Add(listEmail);
objEmail.Priority = System.Net.Mail.MailPriority.High;
objEmail.IsBodyHtml = true;
objEmail.Subject = "System NDRSecurity - Novas Requisições.";
objEmail.Body = "EX";
objEmail.SubjectEncoding = Encoding.GetEncoding("ISO-8859-1");
objEmail.BodyEncoding = Encoding.GetEncoding("ISO-8859-1");
SmtpClient objSmtp = new SmtpClient("XXX");
objSmtp.EnableSsl = true;
objSmtp.Port = 25;
objSmtp.Credentials = new NetworkCredential("caio.jesus@ex.com", "XXX");
objSmtp.Send(objEmail);