Email setup not working on docker container on server

I am currently trying to configure email verification for my server I am running. I currently cannot get keycloak to connect to my mailjet server from my cloud server, but it works fine if I create a keycloak server locally on my machine.

I click the test connection in the email tab on the keycloak server and it fails to connect.

But the exact same steps work fine when I do them on my local machine.

It is connecting to my own Postgres server, but it is a fresh server and it still happens if I also don’t provide a server.

I am running a Linode server:
Alpine 3.12, Nanode 1GB: 1 CPU, 25GB Storage, 1GB RAM

I tried testing with Ubuntu and it still failed.

Docker-compose file:
version: “3.7”



        image: jboss/keycloak


            DB_VENDOR: "postgres"

            DB_ADDR: "${WEBSITE}"

            DB_DATABASE: "postgres"

            DB_USER: "postgres"

            DB_SCHEMA: public

            DB_PASSWORD: "${MASTER_KEY}"

            DB_PORT: "5432"




            - "8443:8443"

And for mailjet, I am just following their SMTP relay guide. I have tried port 25, 587, and I have tried SSL with smartTSL on and off for port 465.

If you think it is something specific with the Lindoe server configuration, I can raise an issue with them.

I have also tested connecting to the smtp server using the bash script from the linode server, and that works fine.

: ${TEMPLATE:="291077"}
: ${TO:=''}
: ${TO_NAME:='Testers'}
: ${FROM:=''}
: ${FROM_NAME:='Your name'}
: ${SUBJECT:="Email sent by script $0"}
: ${VARIABLES:='"var1": "Some variable", "var2": "29819012"'}
: ${DEBUG:=0}
  cat <<EOF
      "From": { "Email": "$FROM", "Name": "$FROM_NAME" },
      "To": [{ "Email": "$TO", "Name": "$TO_NAME" }],
      "TemplateID": $TEMPLATE,
      "TemplateLanguage": true,
      "Subject": "$SUBJECT",
      "Variables": {$VARIABLES}
  echo "Sending template id ${TEMPLATE}"
  echo "using variables : ${VARIABLES}"
  if [ ${DEBUG} == "true" ];then
    echo "$(mj_payload)"
send() {
  curl -s \
      -X POST \
      --user "${MJ_APIKEY_PUBLIC}:${MJ_APIKEY_PRIVATE}" \ \
      -H 'Content-Type: application/json' \
      -d "$(mj_payload)"

Found out Linode blocks smtp ports 25, 587, 465 by default:

Going to request to get it removed and see if this solves the problem.