Moving everything to postfix relay

This commit is contained in:
Finley Ghosh 2025-09-13 22:40:19 +10:00
parent c54d50d3fc
commit d793f7b6ed
7 changed files with 50 additions and 43 deletions

BIN
app/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -47,44 +47,13 @@ Configure::write('version', '1.0.1');
$host = $_SERVER['HTTP_HOST']; $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 // SMTP settings
// Configure::write('smtp_settings', array( 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(
'port' => '25', 'port' => '25',
'timeout' => '30', '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 //Production/Staging Config

BIN
app/webroot/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -56,7 +56,7 @@ DB_NAME=cmc
DB_ROOT_PASSWORD=secureRootPassword DB_ROOT_PASSWORD=secureRootPassword
# Environment variables for Go app mail configuration # Environment variables for Go app mail configuration
SMTP_HOST="172.17.0.1" SMTP_HOST=postfix
SMTP_PORT=25 SMTP_PORT=25
SMTP_USER="" SMTP_USER=""
SMTP_PASS="" SMTP_PASS=""

View file

@ -56,8 +56,8 @@ DB_NAME=cmc
DB_ROOT_PASSWORD=secureRootPassword DB_ROOT_PASSWORD=secureRootPassword
# Environment variables for Go app mail configuration # Environment variables for Go app mail configuration
SMTP_HOST="host.docker.internal" SMTP_HOST=postfix
SMTP_PORT=1025 SMTP_PORT=25
SMTP_USER="" SMTP_USER=""
SMTP_PASS="" SMTP_PASS=""
SMTP_FROM="CMC Sales <sales@cmctechnologies.com.au>" SMTP_FROM="CMC Sales <sales@cmctechnologies.com.au>"

View file

@ -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: services:
nginx: nginx:
image: nginx:latest image: nginx:latest
@ -20,7 +39,7 @@ services:
dockerfile: Dockerfile.prod dockerfile: Dockerfile.prod
container_name: cmc-prod-php container_name: cmc-prod-php
environment: environment:
MAIL_HOST: 172.17.0.1 MAIL_HOST: postfix
MAIL_PORT: 25 MAIL_PORT: 25
DB_HOST: db DB_HOST: db
DB_PORT: 3306 DB_PORT: 3306
@ -47,7 +66,7 @@ services:
DB_PASSWORD: xVRQI&cA?7AU=hqJ!%au DB_PASSWORD: xVRQI&cA?7AU=hqJ!%au
DB_NAME: cmc DB_NAME: cmc
PORT: 8082 PORT: 8082
SMTP_HOST: 172.17.0.1 SMTP_HOST: postfix
SMTP_PORT: 25 SMTP_PORT: 25
SMTP_USER: "" SMTP_USER: ""
SMTP_PASS: "" SMTP_PASS: ""

View file

@ -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: services:
nginx: nginx:
image: nginx:latest image: nginx:latest
@ -20,8 +39,8 @@ services:
dockerfile: Dockerfile.stg.php dockerfile: Dockerfile.stg.php
container_name: cmc-stg-php container_name: cmc-stg-php
environment: environment:
MAIL_HOST: mailpit MAIL_HOST: postfix
MAIL_PORT: 1025 MAIL_PORT: 25
DB_HOST: db DB_HOST: db
DB_PORT: 3306 DB_PORT: 3306
DB_USER: cmc DB_USER: cmc
@ -47,8 +66,8 @@ services:
DB_PASSWORD: xVRQI&cA?7AU=hqJ!%au DB_PASSWORD: xVRQI&cA?7AU=hqJ!%au
DB_NAME: cmc DB_NAME: cmc
PORT: 8082 PORT: 8082
SMTP_HOST: mailpit SMTP_HOST: postfix
SMTP_PORT: 1025 SMTP_PORT: 25
SMTP_USER: "" SMTP_USER: ""
SMTP_PASS: "" SMTP_PASS: ""
SMTP_FROM: "sales@cmctechnologies.com.au" SMTP_FROM: "sales@cmctechnologies.com.au"