[Dovecot] fix: LDA logging
David Lee
t.d.lee at durham.ac.uk
Wed Oct 4 20:14:55 UTC 2006
Timo:
As discussed over the last couple of days. Please could the attached
patch be applied to "deliver.c" so that it can log (syslog etc.) final
delivery into the destination mailbox.
This completes a hitherto missing part in logging an email's progress; it
is useful (for example) to diagnose "my email wasn't delivered" problems.
Thanks.
--
: David Lee I.T. Service :
: Senior Systems Programmer Computer Centre :
: Durham University :
: http://www.dur.ac.uk/t.d.lee/ South Road :
: Durham DH1 3LE :
: Phone: +44 191 334 2752 U.K. :
-------------- next part --------------
--- deliver.c.rc7+ 2006-09-25 10:36:59.885645000 +0100
+++ deliver.c 2006-10-04 18:01:31.910181000 +0100
@@ -103,12 +103,15 @@
struct mailbox *box;
struct mailbox_transaction_context *t;
struct mail_keywords *kw;
+ const char *str;
int ret = 0;
box = mailbox_open_or_create_synced(storage, mailbox);
if (box == NULL)
return -1;
+ str = mail_get_first_header(mail, "Message-ID");
+
t = mailbox_transaction_begin(box, MAILBOX_TRANSACTION_FLAG_EXTERNAL);
kw = strarray_length(keywords) == 0 ? NULL :
@@ -117,10 +120,14 @@
ret = -1;
mailbox_keywords_free(t, &kw);
- if (ret < 0)
+ if (ret < 0) {
+ i_info("failed to deliver msgid=%s to %s", str, mailbox);
mailbox_transaction_rollback(&t);
- else
+ }
+ else {
+ i_info("delivered msgid=%s to %s", str, mailbox);
ret = mailbox_transaction_commit(&t, 0);
+ }
mailbox_close(&box);
return ret;
More information about the dovecot
mailing list