Sometimes cannot send SMTP mail through gmail

I can send gmail manually, but I cannot always send SMTP gmail successfully, and the error occurrence rate is about 70 percent.

Error message : A connection attempted failed because the connected party did not properly respond after a period of time…

I have tried every method posted on the forum but still not working, such as modifying google and gmail settings,ssl,change 465 to 587 port etc.Then, I tried to put send SMTP with try catch in a loop, loop stops when it sends. Although it finally send SMTP mail, time wasted a lot in the loop. I tried to modify timeout to several seconds, but it still toke over 20 seconds to failure.
Do you have any good ideas? Thanks in advance, sorry for my mediocre English.

1 Like

This is due to the server may be down or running slow. The major issue ofcourse , will be the any proxy or anti virus blocking the smtp servers blocking the connection.

And check if you have enabled the less secure apps in your gmail account

@gareth_Hua Thank you for highlighting this issue. I have been facing the same issue for some time now. If I have 100 transactions, it works for upto 60 to 65 transactions and then starts showing the error that u have mentioned. Kindly update if you have found any better approach to handle this behaviour.

As far as I know, it was just with the time taken by the SMTP to send the mail. I guess the short delay between sending the mails will help here. Please try providing the delay of 2 seconds between each mail trigger @Manjunath_Ramappa

Hey @HareeshMR, Thank you for your input, I will try this.