Php 7 Smtp Connect() Failed. Error

We have switched to PHP 7. We have been getting the error below when an order placed at customer side:

SMTP connect() failed.

What is the problem and solution?

I switched to the "via php mail function" option under Settings > E-mails.

Verify the hostname of your SMTP server. I think you'd get a different error if you had an authentication failure but not entirely sure.