Compare commits

...

1 Commits

Author SHA1 Message Date
e18e698fb9 glue: fix portal smtp host and mail sync export 2026-01-19 00:35:40 -03:00
3 changed files with 8 additions and 8 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ __pycache__/
*.py[cod]
.pytest_cache
.venv
tmp/

View File

@ -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"

View File

@ -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=$(