diff --git a/app/.DS_Store b/app/.DS_Store new file mode 100644 index 00000000..1fed6122 Binary files /dev/null and b/app/.DS_Store differ diff --git a/app/config/core.php b/app/config/core.php index 618ffba2..dc407e5e 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -47,44 +47,13 @@ Configure::write('version', '1.0.1'); $host = $_SERVER['HTTP_HOST']; -/*Configure::write('smtp_settings', array( - 'port' => '587', - 'timeout' => '60', - 'host' => 'smtp-relay.gmail.com', - 'username' => 'sales', - 'password' => 'S%s\'mMZ})MGsg$k!5N|mPSQ>}' - )); -*/ -// SMTP settings for production -// Configure::write('smtp_settings', array( -// 'port' => '25', -// 'timeout' => '30', -// 'host' => '172.17.0.1')); - - -// SMTP settings for production -if (in_array($host, $production_hosts)) { - Configure::write('smtp_settings', array( +// SMTP settings +Configure::write('smtp_settings', array( 'port' => '25', 'timeout' => '30', - 'host' => '172.17.0.1' + 'host' => 'postfix' )); -} else { - // SMTP settings for staging - Configure::write('smtp_settings', array( - 'port' => '1025', - 'timeout' => '30', - 'host' => 'mailpit')); -} - - -// Mailhog SMTP settings for local development -// Configure::write('smtp_settings', array( -// 'port' => '1025', -// 'timeout' => '30', -// 'host' => 'host.docker.internal' -// )); //Production/Staging Config diff --git a/app/webroot/.DS_Store b/app/webroot/.DS_Store new file mode 100644 index 00000000..ccfdfd56 Binary files /dev/null and b/app/webroot/.DS_Store differ diff --git a/deploy/deploy-prod.sh b/deploy/deploy-prod.sh index de4e8089..821a32cb 100755 --- a/deploy/deploy-prod.sh +++ b/deploy/deploy-prod.sh @@ -56,7 +56,7 @@ DB_NAME=cmc DB_ROOT_PASSWORD=secureRootPassword # Environment variables for Go app mail configuration -SMTP_HOST="172.17.0.1" +SMTP_HOST=postfix SMTP_PORT=25 SMTP_USER="" SMTP_PASS="" diff --git a/deploy/deploy-stg.sh b/deploy/deploy-stg.sh index 404d5ddf..8d2f2f51 100755 --- a/deploy/deploy-stg.sh +++ b/deploy/deploy-stg.sh @@ -56,8 +56,8 @@ DB_NAME=cmc DB_ROOT_PASSWORD=secureRootPassword # Environment variables for Go app mail configuration -SMTP_HOST="host.docker.internal" -SMTP_PORT=1025 +SMTP_HOST=postfix +SMTP_PORT=25 SMTP_USER="" SMTP_PASS="" SMTP_FROM="CMC Sales " diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 1dcc270b..56606e2e 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,3 +1,22 @@ +# Postfix SMTP relay for Gmail + postfix: + image: boky/postfix + restart: unless-stopped + # Staging: relay to Mailpit (no authentication required) + environment: + - RELAYHOST=mailpit.stg.internal + - RELAYHOST_PORT=1025 + - ALLOWED_SENDER_DOMAINS=* + # --- Gmail SMTP relay settings (uncomment for production) --- + # - RELAYHOST=smtp-relay.gmail.com + # - RELAYHOST_PORT=587 + # - SMTP_USERNAME=sales + # - SMTP_PASSWORD=S%s'mMZ})MGsg$k!5N|mPSQ> + # - SMTP_TLS_SECURITY_LEVEL=encrypt + # - SMTP_USE_TLS=yes + # - SMTP_USE_STARTTLS=yes + ports: + - "25:25" services: nginx: image: nginx:latest @@ -20,7 +39,7 @@ services: dockerfile: Dockerfile.prod container_name: cmc-prod-php environment: - MAIL_HOST: 172.17.0.1 + MAIL_HOST: postfix MAIL_PORT: 25 DB_HOST: db DB_PORT: 3306 @@ -47,7 +66,7 @@ services: DB_PASSWORD: xVRQI&cA?7AU=hqJ!%au DB_NAME: cmc PORT: 8082 - SMTP_HOST: 172.17.0.1 + SMTP_HOST: postfix SMTP_PORT: 25 SMTP_USER: "" SMTP_PASS: "" diff --git a/docker-compose.stg.yml b/docker-compose.stg.yml index c240c1ad..86617dbb 100644 --- a/docker-compose.stg.yml +++ b/docker-compose.stg.yml @@ -1,3 +1,22 @@ +# Postfix SMTP relay for Gmail + postfix: + image: boky/postfix + restart: unless-stopped + # Staging: relay to Mailpit (no authentication required) + environment: + - RELAYHOST=mailpit.stg.internal + - RELAYHOST_PORT=1025 + - ALLOWED_SENDER_DOMAINS=* + # --- Gmail SMTP relay settings (uncomment for production) --- + # - RELAYHOST=smtp-relay.gmail.com + # - RELAYHOST_PORT=587 + # - SMTP_USERNAME=sales + # - SMTP_PASSWORD=S%s'mMZ})MGsg$k!5N|mPSQ> + # - SMTP_TLS_SECURITY_LEVEL=encrypt + # - SMTP_USE_TLS=yes + # - SMTP_USE_STARTTLS=yes + ports: + - "25:25" services: nginx: image: nginx:latest @@ -20,8 +39,8 @@ services: dockerfile: Dockerfile.stg.php container_name: cmc-stg-php environment: - MAIL_HOST: mailpit - MAIL_PORT: 1025 + MAIL_HOST: postfix + MAIL_PORT: 25 DB_HOST: db DB_PORT: 3306 DB_USER: cmc @@ -47,8 +66,8 @@ services: DB_PASSWORD: xVRQI&cA?7AU=hqJ!%au DB_NAME: cmc PORT: 8082 - SMTP_HOST: mailpit - SMTP_PORT: 1025 + SMTP_HOST: postfix + SMTP_PORT: 25 SMTP_USER: "" SMTP_PASS: "" SMTP_FROM: "sales@cmctechnologies.com.au"