I am sending bulk emails to an corporation exchange server, using a client application written in C#.
It can happen, and it did, that the client application timeout (not the server). Since there is no way to know if the server completed the request, how to handle retrys for this case?
There are no ids involved that could be use to avoid duplicates. Setting long timeouts or even infinite timeouts is not a good policy.
I am using exponential backoff algorithm for retry. In this case it should only send only one duplicate because it will wait longer next time.
I think there is no bullet prof solution. Anyway, since it is first project of the kind, i need to check to see if someone has a solution that i miss looked.
Update: The exchange is doing the relay. I am using an SmtpClient to send e-mails. The problem is that the server can send the 250 Ok message, but the receiver never gets it, and then try again. That is the only problem i am trying to solve in this post.
In Rest services the recommended approach is to use an concurrency error. If the client post something and get "409 - conflict" status that means the message was already stored on the server. But for that to happen there as to be a key for the message that is created by the client and is part of the message. SMTP doesn't seem to have a mechanism that can prevent that.