tiredofit / docker-postal

Dockerized SMTP server
MIT License
47 stars 25 forks source link

change the smtp port #4

Open dtrckd opened 3 years ago

dtrckd commented 3 years ago

Good evening,

How can we change the smtp port of the exposed container ? I set it to 25:2525 in the docker-compose file but it doesn't seem to work.

I see that the network ports are also defined in the DockerFile so maybe its hardcoded ?

tiredofit commented 3 years ago

TrySMTP_SERVER_PORT as en environment variable.

Defaults are here. Looks like I haven't kept the README up to date for a while, my apologies.

dtrckd commented 3 years ago

thanks @tiredofit. I just try that: SMTP_SERVER_PORT=2525 docker-compose up -d but the app/config/postal.yml file still have SMTP port at 25. Is that the right way to proceed ?

tiredofit commented 3 years ago

Yes, that should just work, provided you have not switched SETUP_TYPE=MANUAL

This is a snippet of the config that I write:

smtp_server:
  port: ${SMTP_SERVER_PORT}
  tls_enabled: ${SMTP_SERVER_ENABLE_TLS}
  tls_certificate_path: ${SMTP_SERVER_TLS_CERT}
  tls_private_key_path: ${SMTP_SERVER_TLS_KEY}
  tls_ciphers: ${SMTP_SERVER_TLS_CIPHERS}
  ssl_version: ${SMTP_SERVER_SSL_VERSION}
  proxy_protocol: ${SMTP_SERVER_PROXY_PROTOCOL}
  log_connect: ${SMTP_SERVER_LOG_CONNECTIONS}
  strip_received_headers: ${SMTP_SERVER_STRIP_RECEIVED_HEADERS}
  max_message_size: ${SMTP_SERVER_MAX_MESSAGE_SIZE}
dtrckd commented 3 years ago

I tried bringing the docker-compose down then up again and the port is still at 25, I don't know why.

But, I could solved my initial problem related to the port mapping 25:25 which apparently cause some trouble with docker-compose and that resulted in a bad mapping.

It works now by using quote as follows "25:25", as also mentioned here: https://github.com/tomav/docker-mailserver/issues/684#issuecomment-322029158.

thanks a lot :)