What should I do to avoid following error:
What is the email provider you are using?
Are there instructions for the proper setup?
Try looking here:
I am using gmail.
But now the error is resolved. My antivirus was responsible for the error. Due to security reasons, the antivirus was not allowing to establish the connection. But after disabling the antivirus, code is running perfectly.
Thank you for your helping me.