Question:
Hi,
Is there a way to make the verification of connection of login a faster one? Below is my code...
Select Case action Case Framework.Base.Shared.EmailSendAndReceive.Incoming mailMan.MailHost = "pop.gmail.com" mailMan.PopUsername = "johndoe@gamil.com"
mailMan.PopPassword = ""
mailMan.MailPort = 995
mailMan.SizeLimit = 0
Case Framework.Base.Shared.EmailSendAndReceive.OutGoing
mailMan.SmtpHost = "smtp.gmail.com"
mailMan.SmtpUsername = "johndoe@gamil.com"
mailMan.SmtpPort = 587
End Select
'Here relies the issue, it takes a lot of time before it gives response that it failed.
If MailMan.VerifySmtpConnection Then
MessageBox.Show("Failed TCP/IP connection")
ElseIf MailMan.VerifySmtpLogin Then
MessageBox.Show("Failed to login")
End If
The VerifySmtpConnection and VerifySmtpLogin methods were not intended to be called prior to calling SendEmail. The intent was that if SendEmail returns a failed status, you could first check the LastSmtpStatus property for a quick summary -- assuming the process of sending progressed to a point where an SMTP status response was received. If not, you could then fall back to calling VerifySmtpLogin to see if the SMTP authentication succeeds. Again, you could check LastSmtpStatus, or you could then call VerifySmtpConnection.
If the problem is with establishing a TCP/IP socket connection to the server, and if the failure is such that the connect request times out, then THAT is the cause of the long delay.
Yes, that's what I did. I didn't call the methods VerifySmtpConnection and VerifySmtpLogin before sending the email. I called it after sending the email and it fails.
However, on our case, we have a wizard form that will setup the email account of the user. During setup, we verify the data input by the user, and one of the verification is the said methods.
So I'm going back again to my question... Is there a way to make the verification a faster one? Because it takes 20-30 minutes the response/feedback going back to us.
any update on this?
Hi,
It's already 2 months and still there's no feedback from you. Did you guys look with my main concern? Our clients were very frustrated with this.
Is it really taking 20-30 minutes for your VerifySmtpConnection/VerifySmtpLogin calls to return?
Maybe you've set the ConnectionTimeout and/or ReadTimeout properties too high? Note that the parameter values for those properties should be in seconds, not milliseconds. I know some other APIs and libraries tend you use milliseconds over seconds, so that might be a common place to make an error that would dramatically increase the time that timeouts take to happen.