[Dovecot] deliver w/quotas - MDN after accept mail?
I'm testing deliver with sendmail and fs quotas.
On an over quota condition, deliver accepts the mail, deletes it, then issues a MDN immediately.
Is there a way to get deliver to soft fail like procmail does with a 400 error and queue the mail, then let sendmail handle the MDN, following it's "confTO_QUEUEWARN" and "confTO_QUEUERETURN" ?
Thanks, Ken
-- Ken Anderson Pacific.Net
"KA" == Ken A <ka@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..".
thanks! -e did it. Ken
pod wrote:
"KA" == Ken A <ka@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.
Tried with -e, but sendmail says EX_NOPERM is a permanent error, and issues it's own DSN immediately. "dsn=5.0.0, stat=Insufficient permission". :-(
Ken
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..".
-- Ken Anderson Pacific.Net
Ken A wrote:
thanks! -e did it.
correction.. sendmail says EX_NOPERM is a permanent error, and issues it's own DSN immediately. "dsn=5.0.0, stat=Insufficient permission". Ken
Ken
pod wrote:
> "KA" == Ken A <ka@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.
Tried with -e, but sendmail says EX_NOPERM is a permanent error, and issues it's own DSN immediately. "dsn=5.0.0, stat=Insufficient permission". :-(
Ken
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..".
-- Ken Anderson Pacific.Net
On Tue, 2007-09-25 at 15:05 -0500, Ken A wrote:
Ken A wrote:
thanks! -e did it.
correction.. sendmail says EX_NOPERM is a permanent error, and issues it's own DSN immediately. "dsn=5.0.0, stat=Insufficient permission".
v1.1 has:
# If user is over quota, return with temporary failure instead of # bouncing the mail. #quota_full_tempfail = no
With v1.0 you'll need to modify the sources.
"KA" == Ken A <ka@pacific.net> writes:
KA> Tried with -e, but sendmail says EX_NOPERM is a permanent error,
KA> and issues it's own DSN immediately. "dsn=5.0.0, stat=Insufficient
KA> permission". :-(
Not unexpected. I assumed (but neglected to express the assumption :) one could configure sendmail to consider the EX_NOPERM a temporary failure if one wanted that sort of behaviour. Not great I admit.
participants (3)
-
Ken A
-
pod
-
Timo Sirainen