我正在尝试使用 Mailaddress 类发送多封电子邮件(> 10),但显然它不喜欢它。有没有办法将6号之后的电子邮件附加到CC?
或任何其他解决方法?
我有:
(<email1@test.com>; <email2@test.com>; <email3@test.com>, <email4@test.com>; <email5@test.com>; \r\n\t<email6@test.com>, <email7@test.com>; <email8@test.com>\r\n\TEXT)
我做 Environment.NewLine,我将 < 、 > 、 \t 和 " " 替换为 "" (不知道其他更好的格式化方法)
当我尝试通过 mailaddress 类发送它时,出现格式错误。但是当电子邮件数量较少时工作正常。
解决了:
string to = ""; string cc = ""; int i = 0; foreach (string item in multiAddress.Split(',')) { i += 1; if (i < 10) { to += item + ","; } else { cc += item + ","; } } to = to.Remove(to.Length - 1); cc = cc.Remove(cc.Length - 1);