Discourse unable to send out email using SparkPost

Problem: Job exception: 500 5.5.2 unrecognized command

Following default discourse install using the official guide, email was not sent out for admin account creation after successful installation.

Checking the log
/var/discourse# tail shared/standalone/log/rails/production.log

Found the following error:
Sent mail to admin@email.com (1499.0ms)
[default] Job exception: 500 5.5.2 unrecognized command

This was the more detailed error shown in sidekiq after successfully resolved the problem using solution below:
Job: Jobs::CriticalUserEmail
Error: Jobs::HandledExceptionWrapper: Wrapped Net::SMTPAuthenticationError: 500 5.5.2 unrecognized command

Solution: uncomment the SMTP port in app.yml

Found the solution from Discourse Meta: uncomment the port setting in app.yml to explicitly use port 587. Rebuild app and it should work now.

Suspected the reason being default port was not applied during manual bootstrap due to not following the default prompt and instead manually bootstrapped app after editing app.xml to change the default from email used to comply with SparkPost.