[PATCH] Make Delivered-To optional
Nagy, Attila
bra at fsn.hu
Tue Jan 13 10:42:59 UTC 2015
Hi,
I've read at least one e-mail on this list about making delivered-to in
lmtpd optional, but now I need this too, so I made a patch. The default
remains as is now (enabled).
Rationale: I would like to dsync users and I have catchall POP mailboxes
(meaning: a single mailbox gets the mails for a lot of e-mail addresses).
If I deliver the e-mails to Dovecot's lmtpd as the original RCPT TO, the
Delivered-To header can be used for the POP client to sort the messages
on their side to the correct mailbox, but because Dovecot sees this as a
new user, it adds it to the replicator.db.
Now imagine a single mailbox with thousands of e-mail addresses, this
will make thousands of entries in replicator.db, all of which Dovecot
would like to replicate independently...
If I deliver to the mailbox uid, Dovecot dsync will work right (only one
user will be added, no matter how many different e-mail addresses end up
in this mailbox), but the Delivered-To will contain the uid, so the user
can't use that to sort the messages into their final destination on
their side.
So the solution here is that I disable the addition of Delivered-To
header in Dovecot (because it doesn't know what is the original address)
and add it in an upper layer, so during the lmtp transaction, the
message will already contain the right value.
Currently Dovecot adds another Delivered-To line, which confuses the
clients.
Please add this feature to Dovecot.
Thanks,
-------------- next part --------------
diff -r e3640ccaa76d doc/example-config/conf.d/20-lmtp.conf
--- a/doc/example-config/conf.d/20-lmtp.conf Sat Jan 10 04:32:42 2015 +0200
+++ b/doc/example-config/conf.d/20-lmtp.conf Tue Jan 13 11:29:20 2015 +0100
@@ -13,8 +13,11 @@
# Verify quota before replying to RCPT TO. This adds a small overhead.
#lmtp_rcpt_check_quota = no
+# Insert Delivered-To header to the messages, delivered through LMTP.
+#lmtp_add_delivered_to = yes
+
protocol lmtp {
# Space separated list of plugins to load (default is global mail_plugins).
#mail_plugins = $mail_plugins
}
-
\ No newline at end of file
+
diff -r e3640ccaa76d src/lmtp/commands.c
--- a/src/lmtp/commands.c Sat Jan 10 04:32:42 2015 +0200
+++ b/src/lmtp/commands.c Tue Jan 13 11:29:20 2015 +0100
@@ -996,7 +996,7 @@
if (array_count(&client->state.rcpt_to) > 0) {
str_printfa(str, "Return-Path: <%s>\r\n",
client->state.mail_from);
- if (rcpt_to != NULL)
+ if (rcpt_to != NULL && client->lmtp_set->lmtp_add_delivered_to)
str_printfa(str, "Delivered-To: %s\r\n", rcpt_to);
}
diff -r e3640ccaa76d src/lmtp/lmtp-settings.c
--- a/src/lmtp/lmtp-settings.c Sat Jan 10 04:32:42 2015 +0200
+++ b/src/lmtp/lmtp-settings.c Tue Jan 13 11:29:20 2015 +0100
@@ -60,6 +60,7 @@
DEF(SET_BOOL, lmtp_proxy),
DEF(SET_BOOL, lmtp_save_to_detail_mailbox),
DEF(SET_BOOL, lmtp_rcpt_check_quota),
+ DEF(SET_BOOL, lmtp_add_delivered_to),
DEF(SET_STR, lmtp_address_translate),
DEF(SET_STR_VARS, login_greeting),
DEF(SET_STR, login_trusted_networks),
@@ -71,6 +72,7 @@
.lmtp_proxy = FALSE,
.lmtp_save_to_detail_mailbox = FALSE,
.lmtp_rcpt_check_quota = FALSE,
+ .lmtp_add_delivered_to = TRUE,
.lmtp_address_translate = "",
.login_greeting = PACKAGE_NAME" ready.",
.login_trusted_networks = ""
diff -r e3640ccaa76d src/lmtp/lmtp-settings.h
--- a/src/lmtp/lmtp-settings.h Sat Jan 10 04:32:42 2015 +0200
+++ b/src/lmtp/lmtp-settings.h Tue Jan 13 11:29:20 2015 +0100
@@ -8,6 +8,7 @@
bool lmtp_proxy;
bool lmtp_save_to_detail_mailbox;
bool lmtp_rcpt_check_quota;
+ bool lmtp_add_delivered_to;
const char *lmtp_address_translate;
const char *login_greeting;
const char *login_trusted_networks;
More information about the dovecot
mailing list