I am trying to send multiple emails (>10) using Mailaddress class but apparently, it's not liking it. is there a way to attach emails after the 6th to CC?
or any other work around?
I have:
(<[email protected]>; <[email protected]>; <[email protected]>, <[email protected]>; <[email protected]>; \r\n\t<[email protected]>, <[email protected]>; <[email protected]>\r\n\TEXT)
I do Environment.NewLine, I replace < , > , \t and " " with "" (don't know any other better way to format it)
when I try to send it via mailaddress class I am getting an format error. but is working fine when the number of emails are less.
Solved:
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);