--- /dev/null
+#!/bin/bash
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2015 Michael Tremer <michael.tremer@ipfire.org> #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+SPOOL_DIR="/var/spool/dma"
+
+find_messages() {
+ find "${SPOOL_DIR}" -type f -name "M*" -mtime +30
+}
+
+remove_message() {
+ local f_message="${1}"
+ local f_queue="${f_message/${SPOOL_DIR}\/M/${SPOOL_DIR}\/Q}"
+
+ # If a message file and a queue file exist, delete both
+ [ -f "${f_message}" ] || return 1
+ [ -f "${f_queue}" ] || return 1
+
+ rm -f "${f_message}" "${f_queue}"
+ return 0
+}
+
+main() {
+ for message in $(find_messages); do
+ remove_message "${message}"
+ done
+
+ return 0
+}
+
+main || exit $?
--- /dev/null
+###############################################################################
+# IPFire.org - An Open Source Firewall Solution #
+# Copyright (C) - IPFire Development Team <info@ipfire.org> #
+###############################################################################
+
+name = dma
+version = 0.10
+release = 1
+
+groups = Mail
+url = https://github.com/corecode/dma
+license = BSD
+summary = DragonFly Mail Agent
+
+description
+ dma is a small Mail Transport Agent (MTA), designed for home and
+ office use. It accepts mails from locally installed Mail User Agents
+ (MUA) and delivers the mails either locally or to a remote destination.
+
+ Remote delivery includes several features like TLS/SSL support and
+ SMTP authentication.
+end
+
+build
+ requires
+ bison
+ flex
+ openssl-devel
+ end
+
+ make_build_targets += PREFIX=%{prefix}
+
+ # Workaround for #10952
+ make_build_targets += LEX="flex -l"
+
+ make_install_targets += PREFIX=%{prefix} \
+ sendmail-link mailq-link install-spool-dirs install-etc
+
+ install_cmds
+ install -m 755 %{DIR_SOURCE}/dma-cleanup-spool %{BUILDROOT}%{sbindir}
+ end
+end
+
+packages
+ package %{name}
+ groups += Base
+
+ script postin
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ systemctl --no-reload enable dma-queue-flush.timer >/dev/null 2>&1 || :
+ systemctl --no-reload enable dma-cleanup-spool.timer >/dev/null 2>&1 || :
+ end
+
+ script preun
+ systemctl --no-reload disable dma-queue-flush.timer >/dev/null 2>&1 || :
+ systemctl --no-reload disable dma-cleanup-spool.timer >/dev/null 2>&1 || :
+ systemctl stop dma-queue-flush.timer >/dev/null 2>&1 || :
+ systemctl stop dma-cleanup-spool.timer >/dev/null 2>&1 || :
+ systemctl stop dma-queue-flush.service >/dev/null 2>&1 || :
+ systemctl stop dma-cleanup-spool.service >/dev/null 2>&1 || :
+ end
+
+ script postun
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ end
+
+ script postup
+ systemctl daemon-reload >/dev/null 2>&1 || :
+ end
+ end
+
+ package %{name}-debuginfo
+ template DEBUGINFO
+ end
+end
--- /dev/null
+[Unit]
+Description=Cleanup of the DMA mail spool directory
+
+[Service]
+ExecStart=/usr/sbin/dma-cleanup-spool
--- /dev/null
+[Unit]
+Description=Periodly cleanup of the DMA mail spool directory
+
+[Timer]
+OnCalendar=weekly
+Persistent=true
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+[Unit]
+Description=Flushing of the DMA mail queue.
+After=network-online.target
+Requires=network-online.target
+Wants=network-online.target
+
+[Service]
+SendSIGKILL=false
+TimeoutStopSec=0
+ExecStart=/usr/sbin/dma -q
--- /dev/null
+[Unit]
+Description=Periodly flushing of the DMA mail queue.
+
+[Timer]
+OnCalendar=hourly
+Persistent=true
+
+[Install]
+WantedBy=multi-user.target