From b6609a97061cfbe63f2033d625df312bd6c77542 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Mon, 19 Jan 2026 00:35:40 -0300 Subject: [PATCH] glue: fix portal smtp host and mail sync export --- .gitignore | 1 + services/bstein-dev-home/backend-deployment.yaml | 2 +- .../scripts/nextcloud-mail-sync.sh | 13 ++++++------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 8e09aa9..8d0ab1e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ __pycache__/ *.py[cod] .pytest_cache .venv +tmp/ diff --git a/services/bstein-dev-home/backend-deployment.yaml b/services/bstein-dev-home/backend-deployment.yaml index ba6ca74..b65d477 100644 --- a/services/bstein-dev-home/backend-deployment.yaml +++ b/services/bstein-dev-home/backend-deployment.yaml @@ -34,7 +34,7 @@ spec: export PORTAL_E2E_CLIENT_SECRET="{{ .Data.data.client_secret }}" {{ end }} {{ with secret "kv/data/atlas/shared/postmark-relay" }} - export SMTP_HOST="mail.bstein.dev" + export SMTP_HOST="smtp.postmarkapp.com" export SMTP_PORT="587" export SMTP_STARTTLS="true" export SMTP_USE_TLS="false" diff --git a/services/nextcloud-mail-sync/scripts/nextcloud-mail-sync.sh b/services/nextcloud-mail-sync/scripts/nextcloud-mail-sync.sh index e75ec91..732b9fb 100755 --- a/services/nextcloud-mail-sync/scripts/nextcloud-mail-sync.sh +++ b/services/nextcloud-mail-sync/scripts/nextcloud-mail-sync.sh @@ -54,17 +54,16 @@ list_mail_accounts() { local export_out # Nextcloud Mail does not provide a list command; export is safe (does not print passwords). - if ! export_out=$(/usr/sbin/runuser -u www-data -- php occ mail:account:export --output json "${user_id}"); then + if ! export_out=$(/usr/sbin/runuser -u www-data -- php occ mail:account:export "${user_id}"); then echo "WARN: unable to export mail accounts for ${user_id}; skipping sync for safety" >&2 return 1 fi - if ! jq -e 'type == "array"' >/dev/null 2>&1 <<<"${export_out}"; then - echo "WARN: unexpected mail export output for ${user_id}; skipping sync for safety" >&2 - return 1 - fi - - jq -r '.[] | "\(.id)\t\(.email)"' <<<"${export_out}" | sort -u + awk -v OFS='\t' ' + BEGIN { IGNORECASE=1; id="" } + $1 == "Account" { id=$2; sub(":", "", id); next } + $1 == "-" && tolower($2) ~ /^e-?mail:$/ { if (id) print id, $3 } + ' <<<"${export_out}" | sort -u } token=$(