Send email to multiple recipients

1

I have a class to send email, which works perfectly for only one recipient, however I need to send to several people, I made a select that searches the emails I need and places the ";". But when I try to send it this way, I get the error "An invalid character was found in the email header: ';'." I tried putting "," returns the same error.

I tried to do this:

 var listaEmail = emailDestinatario;
                var emails = listaEmail.Split(',');

                foreach (var endereco in emails)
                {
                    email.To.Add(endereco);
                }

It does not return an error, but it also does not send the emails. Any suggestions?

    
asked by anonymous 05.07.2017 / 15:37

1 answer

2

mailing list is receiving all emails you want to send by separating with ",". if it is

Try to do this:

                string[] emails = listaEmail.Split(',');

                foreach (var endereco in emails)
                {
                    email.To.Add(endereco);
                }
    
06.07.2017 / 14:46