Open RHAD1969 opened 9 years ago
FWIW to the S22.Imap developers, here's the code I use to do this in MailKit's IMAP implementation:
https://github.com/jstedfast/MailKit/blob/master/MailKit/Net/Imap/ImapClient.cs#L626
Feel free to re-use my logic for this (it's all MIT licensed).
I had the same problem as OP and did following to retry multiple IP addresses with S22.Imap.dll
var ips = Dns.GetHostAddresses("imap.gmail.com"); foreach(var ip in ips) { try { return new ImapClient(ip.ToString(), "993", Email, Password, AuthMethod.Login, true); } catch(SocketException e) //error means server is down, try other IP { //nothing, check next IP for connection } }
imap.gmail.com returns several IP addresses (three right now, but the number might vary depending on time and location). You're supposed to try all three. But S22 fails frequently when creating a ImapClient of the gmail service with error:
A socket operation was attempted to an unreachable network [2a00:1450:4013:c01::6d]:993
If one fails in the manner you see, you're supposed to try the next address, but S22 does not have any option to retry.
Can you add this functionality to automatically retry on a different IP address?
See stackoverflow: http://stackoverflow.com/questions/26156820/a-socket-operation-was-attempted-to-an-unreachable-network-2a0014504013c01