#!/bin/sh
# lda -- call Dovecot's local delivery agent to import messages into IMAP INBOX

mailhost=star

if [ -t 0 ]; then
	echo "${0##*/}: expecting a mail message on stdin" >&2
	exit 2
fi

if [ "$(hostname)" != $mailhost ]; then
	echo "${0##*/}: delivering through $mailhost" >&2
fi

ssh $mailhost /usr/lib/dovecot/dovecot-lda -e -m "${1:-INBOX}"
