Take a look again if it works: Get-TransportConfig
Use the Administrator account (Generally the one which was used to create office365 account) to enable SMTP. I have seen that newer accounts already have this setting enabled by default. If your account is not working try this out.
If above doesn't work for you. Try the following code. Credits Jonathan Cheung