Well, that was definetly easy, the only thing that I needed to do is to make a "MailAdressCollection" and then insert all the emails, and then with a foreach send to each one of the addressess in my Collection, below is my code:
static void Main(string[] args)
{
MailAddressCollection collection = new MailAddressCollection();
collection.Add("xxx@xxx.xx");
collection.Add("xxx@xxx.xx");
foreach (var item in collection)
{
var to = item;
var from = new MailAddress("xxx@xxx.xx");
var message = new MailMessage(from, to);
message.Subject = "Contract";
message.Body = @"Hello, you and your team have been classified to go directly to World Finals for good performance in previous competitions and cups, Sincerely, ICPC Team.";
var client = new SmtpClient("xxx");
client.Credentials = new NetworkCredential("xxx", "xxxx");
Console.WriteLine("Sending an e-mail message to {0} at {1} by using the SMTP host={2}.",
to.User, to.Host, client.Host);
try
{
client.Send(message);
}
catch (Exception ex)
{
Console.WriteLine("Exception caught in CreateTestMessage3(): {0}",
ex.Message);
}
}
}
}