Skip to content

Commit

Permalink
Add self-test to simplelogin
Browse files Browse the repository at this point in the history
  • Loading branch information
quietsy committed Jan 21, 2025
1 parent e4b9f64 commit 2370c19
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/simplelogin.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,24 @@ POSTFIX_SERVER=postfix
DISABLE_ONBOARDING=true
NAMESERVERS="1.1.1.1"
DISABLE_REGISTRATION=0
```
## Self Test
Create `test` aliases for each domain and disable them so you won't get emails.
Add the following to your host's cron, edit the targets and curl command accordingly.
```bash
#!/bin/bash
TARGETS=("[email protected]" "[email protected]" "[email protected]")
for TARGET in "${TARGETS[@]}"; do
docker exec postfix sendmail $TARGET
sleep 10
result=$(docker exec sldb psql -U sl_user simplelogin -AXqtc "SELECT COUNT(*) FROM email_log JOIN alias ON email_log.alias_id = alias.id WHERE alias.email = '$TARGET' AND email_log.created_at BETWEEN NOW() - INTERVAL '5 MINUTES' AND NOW();")
if [[ "$result" -lt 1 ]]; then
curl -d "Email test failed for $TARGET" "https://ntfy.domain1.com/topic"
fi
done
```

0 comments on commit 2370c19

Please sign in to comment.