[Dovecot] deliver w/quotas - MDN after accept mail?

pod pod at herald.ox.ac.uk
Tue Sep 25 21:53:42 EEST 2007


>>>>> "KA" == Ken A <ka at pacific.net> writes:

    KA> I'm testing deliver with sendmail and fs quotas.

    KA> On an over quota condition, deliver accepts the mail, deletes it,
    KA> then issues a MDN immediately.

    KA> Is there a way to get deliver to soft fail like procmail does with
    KA> a 400 error and queue the mail, then let sendmail handle the MDN,
    KA> following it's "confTO_QUEUEWARN" and "confTO_QUEUERETURN" ?

Last time I looked at deliver it seemed like there were very few
conditions it considered as a temporary failure and thus for it to return
EX_TEMPFAIL.  I also was considering over-quota conditions (also
filesystem quotas).

The '-e' option to deliver will, possibly by accidental side-effect, avoid
calling the deliver-generated bounce code.  Instead deliver will write
some error text on stderr and exit EX_NOPERM.

The code in question is src/deliver/deliver.c lines 810 -- 835 which
occurs right after attempting to save the message (i.e. ret is the return
code from the save attempt).  The '-e' option is what sets
stderr_rejection.

	if (ret < 0) {
		const char *error, *msgid;
		bool syntax, temporary_error;
		int ret;

		error = mail_storage_get_last_error(storage, &syntax,
						    &temporary_error);
		if (temporary_error)
			return EX_TEMPFAIL;

		msgid = mail_get_first_header(mail, "Message-ID");
		i_info("msgid=%s: Rejected: %s",
		       msgid == NULL ? "" : str_sanitize(msgid, 80),
		       str_sanitize(error, 512));

		/* we'll have to reply with permanent failure */
		if (stderr_rejection) {
			fprintf(stderr, "%s\n", error);
			return EX_NOPERM;
		}
		ret = mail_send_rejection(mail, destination, error);
		if (ret != 0)
			return ret < 0 ? EX_TEMPFAIL : ret;
		/* ok, rejection sent */
	}

As Timo has said elsewhere "deliver could use a rewrite some day..".


More information about the dovecot mailing list