A Microsoft platform for building enterprise-level data integration and data transformations solutions.
The most likely reason would be that the database hMailserver does not exist.
When you log in through SSMS, you will connect to your default database, unless you explicitly select a database. The default database for sa is typically master, which always exists.
When you connect through an application, it's common that the connection string specifies a database explicitly. If you connect and specify non-existing database, connection will fail. Even if you are sa.
By the way, you are running the release version of SQL 2017. You should download and install the last Cumulative Update, CU31 for SQL 2017 to get access to many bug fixes and enhancements.