#!/usr/bin/env bash

echo -e "Subject: Test\n\nHi there, this is some test." | sendmail -f langbein@mail.de daniel@systemli.org
while :; do
  # Note: smtpctl requires root privileges.
  queue="$(smtpctl show queue)"
  if [ "${queue}" = "" ]; then
    break
  fi
  printf '%s\n' 'Delaying suspend due to non-empty smtpd email queue.'
  sleep 5s
done
