#!/bin/bash
PERCENT=$1
USER=$2
DOMAIN=$3
FROM=$USER

if [ "$#" -eq 0 ]; then
        echo "Usage: $0 <percent> <email> <domain>";
        exit 1;
fi

cat << EOF | /usr/libexec/dovecot/dovecot-lda -d $USER -o "plugin/quota=maildir:User quota:noenforcing"
From: $FROM
Subject: Email Quota Usage: $PERCENT%

This is an automated notification letting you know that your account:
$USER

has used $PERCENT% of it's available space.

EOF

