When sending emails in a batch (30 or more) smtp.SendMessage(IMail) throws an exception:
"An item with the same key has already been added"
My code for sending messages:
ISendMessageResult result = smtp.SendMessage(email);
Exception:
System.ArgumentException was caught
_HResult=-2147024809
_message=An item with the same key has already been added.
HResult=-2147024809
IsTransient=false
Message=An item with the same key has already been added.
Source=mscorlib
StackTrace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary 2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary 2.Add(TKey key, TValue value)
at . (List 1 , List 1 )
at Limilabs.Client.SMTP.Smtp. (SmtpMail )
at Limilabs.Client.SMTP.Smtp.SendMessage(SmtpMail smtpMail)
at Limilabs.Client.SMTP.Smtp.SendMessage(IMail email)
at MailSender.sendMailMessage(IMail email) in c:\MYTFS\MailSender.cs:line 700
at MailSender.mail(List 1 userIDs, List`1 mids, String[] externDataString,
Boolean& result, Nullable 1& mailings_id, Boolean uploadToSent, String replyTo)
in c:\MyTFS\MailSender.cs:line 492
What could be the reason for this?
Is there any kind of timeout associated with communication between an smtp server for sending and the smtp client object?
Any advice is greatfully accepted.
Best Regards /AJ