SpartPost Email Error

I am trying to setup my email settings to use SparkPost as the sending service. I have created the sparkpost api key but when configuring suitecrm and sending a test email I get back thie error:
Error:SMTP connect() failed.
https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
I am using the same sparkpost api key on another markeing software and it works perfectly there so it seems to be an issue with the crm. I hope someone has found a solution to this. Thanks. BTW Im on suitecrm version 7.8.3

I’m afraid this can be a very tricky business, and we’re not even sure if it’s a SuiteCRM bug or a bug in phpMailer (the package used by SuiteCRM for this).

Here you’ll find some discussion, and a script to help debug:

https://github.com/salesagility/SuiteCRM/issues/4146