Hi,
I'm using System.Net.Mail.MailMessage to send emails from my C# Windows app.
I originally had this:
MailMessage mail = new MailMessage("[email protected]", "[email protected]");
etc which worked fine - but then I needed to add mulitple To addresses, so I changed it to this:
MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
foreach (string to in to_add)
{
if (to.Trim() != "")
{
mail.To.Add(to.Trim());
}
}
mail.Body = message;
mail.Subject = "Subject Text";
SmtpClient client = new SmtpClient("0.0.0.0");
client.UseDefaultCredentials = true;
client.Send(mail);
This code can loop through a few times, and there will be at most 3 To addresses in the string array - the first time it is run, it's fine - but then the second loop through, it hangs on
client.Send(mail);
Am I missing something here? It's the first time I've used MailMessage so it is probable that i'm missing something major.
Cheers
leddy
p.s. I'm not using the ip address "0.0.0.0", I've just removed the correct one for security reasons.