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:
(<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)
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);