Using smtp.gmail.com now works locally. I changed the settings in my Gmail account to allow "access for less secure apps".
Remains the questions why localhost does not work and the mendixcloud smtp settings
For the cloud environment, use the string localhost for smpt server and port 25. Leave username, password, SLL and TLS blank. Do use a valid and exisiting from-adress, that you can receive emails in access that account!
Localhost is the actual server the application is running on. So, if you run the application locally (like, on your laptop from the Modeler), you can only connect to localhost port 25 if you also run a mail server on your own computer.
In the cloud environment, you should always be able to use the localhost, port 25, because every environment has a little mail server listening there that will accept your outgoing emails and handle them.