Emails are a very notorious topic in software development, especially because they have different factors affecting the execution of your code—hostname, port, enable SSL, etc.
Since you've not shared the code, my guess is either you're not passing the enable SSL to your code, or the port is incorrect.
Please read the following articles that I wrote a while back that mention these challenges and (potentially) how to solve them:
Sending emails over .NET framework, and general problems – using C# code[
^]
Universal SMTP Code to Send Emails in .NET Apps[
^]