I was using ssl for port 587. However, I spoke to the server engineer and he said that to use tls for it and it worked.