I just wrote some test code looking at System.Net.Mail.SmtpClient sending me the same messages.
int numClients = 10; List<SmtpClient> mailClients = new List<SmtpClient>(); for (int i = 0; i < numClients; i++) { mailClients.Add(new SmtpClient(smtpHost)); } MailMessage msg = new MailMessage(" myAddress@eg.com ", " myAddress@eg.com ", "test message", "" ); foreach (SmtpClient c in mailClients) { c.SendAsync(msg, null); }
All this is normal and runs without any problems, except that I only receive "n - 1" messages. If I send 10 messages, I get only 9 in my inbox. If I send 50, I get only 49, etc.
Note. If I change the code to use send lock, I always get the right amount of messages. eg.
foreach (SmtpClient c in mailClients) { c.Send(msg); }
Any ideas?
source share