Ghost Email Setup with Nginx Reverse Proxy

Trying to setup ghost with ghost community docker image.

The problem I face is that the mail setup is working on my locally run docker-compose, but when run on the server with docker-compose and nginx reverse proxy the request times out.

This is my mail configuration.

...
    "mail": {
        "service": "Gmail",
        "transport": "SMTP",
        "options": {
            "host": "smtp.gmail.com",
            "port": 465,
            "secureConnection": true,
            "auth": {
                "user": "XXXXXXXX@gmail.com",
                "pass": "XXXXXXXXX"
            }
        }
    },
...

I have been trying for the entire day to make sense of this and making no progress. I also tried Mailgun to set it up.

If anyone here has any experience of setting up ghost with nginx-proxy and letsencrypt in docker-compose and getting invitation email to work I will appreciate any pointer you can give me.

Ghose Version 3.15

Use these environment variables in your docker-compose.

    environment: 
      mail__transport: SMTP
      mail__options__host:
      mail__options__port: 
      mail__options__auth__user: 
      mail__options__auth__pass: 
      mail__from: email@domain.com. <email@domain.com>

I got it working like this.
Perhaps bit late of an answer, but might still help you or someone else out.