Messages sent to alias+detail end up in INBOX
Hi, everyone!
I have seemingly correct settings for details to work: when I send a message to user+detail@mydomain.tld, it goes into the "detail" folder of user@mydomain.tld.
Also I have working aliases, so when I send a message to alias@mydomain.tld, it goes into the INBOX folder of user@mydomain.tld.
I expected that when I send a message to alias+detail@mydomain.tld, it would go into the "detail" folder of user@mydomain.tld. However, it goes into the INBOX folder of user@mydomain.tld.
Is it the intended behavior?
Pertinent settings: recipient_delimiter·=·+ lda_mailbox_autocreate·=·yes
Or are these settings not the only ones pertinent to the case?
-- Respectfully, Denis Shadrin
Hi Denis,
I expected that when I send a message to alias+detail@mydomain.tld, it would go into the "detail" folder of user@mydomain.tld. However, it goes into the INBOX folder of user@mydomain.tld.
Is it the intended behavior?
It is.
To achieve the desired folder, you need a sieve script:
https://wiki.dovecot.org/Pigeonhole/Sieve/Examples#Plus_Addressed_mail_filte...
Ensure that you also subscribe to newly created mailboxes (lda_mailbox_autosubscribe=yes).
Best, Anton
Hi, Anton!
Hi Denis,
I expected that when I send a message to alias+detail@mydomain.tld, it would go into the "detail" folder of user@mydomain.tld. However, it goes into the INBOX folder of user@mydomain.tld.
Is it the intended behavior?
It is.
To achieve the desired folder, you need a sieve script:
https://wiki.dovecot.org/Pigeonhole/Sieve/Examples#Plus_Addressed_mail_filte...
Ensure that you also subscribe to newly created mailboxes (lda_mailbox_autosubscribe=yes).
Thanks for the advice.
I have tried using this code from the page you adised:
require ["variables", "fileinto", "envelope", "subaddress", "mailbox"];
if envelope :matches :detail "to" "*" {
# you can prefix with INBOX/ or INBOX. if necessary
# remove :create if you want to permit only existing mailboxes
fileinto :create "${1}";
}
I have also set
lda_mailbox_autosubscribe=yes
Also, I of course have recompiled the sieve with sievec. But the mail is still dropped into INBOX. I suppose it's related to this piece of information also found on that page:
To work with Postfix, this requires that the envelope "to" still contains the full address, so pass it with the -a flag.
If I understand this correctly, this is needed so that the messages sent to alias+detail@mydomain.tld had "Delivered-To" header not with value of "user@mydomain.tld" but with value of "user+detail@mydomain.tld". Am I right?
So I have put into the postfix config this line:
mailbox_command = /usr/lib/dovecot/dovecot-lda -a "$RECIPIENT"
But in the headers of the received messages I have "Delivered-To: user@mydomain.tld" instead of "Delivered-To: user+detail@mydomain.tld". If this is the source of the problem, then how should I try to fix it?
-- Respectfully, Denis Shadrin
On Wed, 17 Feb 2021 18:13:13 +0300 ml@shadrinden.ru wrote:
If I understand this correctly, this is needed so that the messages sent to alias+detail@mydomain.tld had "Delivered-To" header not with value of "user@mydomain.tld" but with value of "user+detail@mydomain.tld". Am I right?
So I have put into the postfix config this line:
mailbox_command = /usr/lib/dovecot/dovecot-lda -a "$RECIPIENT"
But in the headers of the received messages I have "Delivered-To: user@mydomain.tld" instead of "Delivered-To: user+detail@mydomain.tld". If this is the source of the problem, then how should I try to fix it?
Sorry, I just forgot to comment out this line in the postfix config: mailbox_transport·=·lmtp:unix:private/dovecot-lmtp
Now I commented it, and the messages properly have "Delivered-To: user+detail@mydomain.tld" header. But they are still dropped into the INBOX folder, so that was not the cause of the problem.
-- Respectfully, Denis Shadrin
So, there is now way that Dovecot can create folders with "detail" name for mail sent to "alias+detail" address?
On Wed, 17 Feb 2021 18:38:45 +0300 ml@shadrinden.ru wrote:
On Wed, 17 Feb 2021 18:13:13 +0300 ml@shadrinden.ru wrote:
If I understand this correctly, this is needed so that the messages sent to alias+detail@mydomain.tld had "Delivered-To" header not with value of "user@mydomain.tld" but with value of "user+detail@mydomain.tld". Am I right?
So I have put into the postfix config this line:
mailbox_command = /usr/lib/dovecot/dovecot-lda -a "$RECIPIENT"
But in the headers of the received messages I have "Delivered-To: user@mydomain.tld" instead of "Delivered-To: user+detail@mydomain.tld". If this is the source of the problem, then how should I try to fix it?
Sorry, I just forgot to comment out this line in the postfix config: mailbox_transport·=·lmtp:unix:private/dovecot-lmtp
Now I commented it, and the messages properly have "Delivered-To: user+detail@mydomain.tld" header. But they are still dropped into the INBOX folder, so that was not the cause of the problem.
-- Respectfully, Denis Shadrin
Hi,
So, there is now way that Dovecot can create folders with "detail" name for mail sent to "alias+detail" address?
did you take a look into the logs? E.g. in my setup, dovecot complains when sieve should put the message into a folder which does not exist.
Maybe it logs something also in your case why it does not create the folder.
Regards Bjoern
Yo Denis,
As bjoern and Anton already said, you need a sieve script that has a rule that says every mail that has the "detail" keyword in the "to" header must go to the "detail" folder.
It works with static values. But I don't know if you can dynmicaly create folders with the "detail" part put in a variable for example, ask the sieve to create it if it doesn't exist, then deliver mail to it.
Yassine
Le 2/18/21 à 1:27 PM, Bjoern Franke a écrit :
Hi,
So, there is now way that Dovecot can create folders with "detail" name for mail sent to "alias+detail" address?
did you take a look into the logs? E.g. in my setup, dovecot complains when sieve should put the message into a folder which does not exist.
Maybe it logs something also in your case why it does not create the folder.
Regards Bjoern
On 18/02/2021 12:53, Yassine Chaouche wrote:
Yo Denis,
As bjoern and Anton already said, you need a sieve script that has a rule that says every mail that has the "detail" keyword in the "to" header must go to the "detail" folder.
It works with static values. But I don't know if you can dynmicaly create folders with the "detail" part put in a variable for example, ask the sieve to create it if it doesn't exist, then deliver mail to it.
What I use is:
if envelope :detail :regex "to" "(.+)" { set :upperfirst :lower "detail" "${1}"; fileinto :create "Tagged/${detail}"; stop; }
Which says "if the envelope detail is not empty, copy it to a variable called 'detail' and titlecase it, then file the message into Tagged/$detail, creating that if necessary". I think the most relevant part here is using a regex to match on the detail - that copies the value of the detail into $1, which you can then use as you see fit.
Yassine
Le 2/18/21 à 1:27 PM, Bjoern Franke a écrit :
Hi,
So, there is now way that Dovecot can create folders with "detail" name for mail sent to "alias+detail" address?
did you take a look into the logs? E.g. in my setup, dovecot complains when sieve should put the message into a folder which does not exist.
Maybe it logs something also in your case why it does not create the folder.
Regards Bjoern
Le 2/18/21 à 2:08 PM, Darac Marjal a écrit :
What I use is: if envelope :detail :regex "to" "(.+)" { set :upperfirst :lower "detail" "${1}"; fileinto :create "Tagged/${detail}"; stop; }
Which says "if the envelope detail is not empty, copy it to a variable called 'detail' and titlecase it, then file the message into Tagged/$detail, creating that if necessary". I think the most relevant part here is using a regex to match on the detail - that copies the value of the detail into $1, which you can then use as you see fit.
Excellent ! thanks for sharing. This was added to my info.txt file.
Yassine -- admin sysweb.
On Thu, 18 Feb 2021 13:08:28 +0000 Darac Marjal mailinglist@darac.org.uk wrote:
What I use is:
if envelope :detail :regex "to" "(.+)" { set :upperfirst :lower "detail" "${1}"; fileinto :create "Tagged/${detail}"; stop; }
Which says "if the envelope detail is not empty, copy it to a variable called 'detail' and titlecase it, then file the message into Tagged/$detail, creating that if necessary". I think the most relevant part here is using a regex to match on the detail - that copies the value of the detail into $1, which you can then use as you see fit.
Hi!
Are you sure it works with aliases? I have tried putting it in my sieve, but for me it works only for "user+detail", i.e. when I use an actually existing user name + detail. If I use an "alias+detail", the message is still dropped into INBOX.
-- Respectfully, Denis Shadrin
On Thu, 18 Feb 2021 13:08:28 +0000 Darac Marjal mailinglist@darac.org.uk wrote:
What I use is:
if envelope :detail :regex "to" "(.+)" { set :upperfirst :lower "detail" "${1}"; fileinto :create "Tagged/${detail}"; stop; }
Which says "if the envelope detail is not empty, copy it to a variable called 'detail' and titlecase it, then file the message into Tagged/$detail, creating that if necessary". I think the most relevant part here is using a regex to match on the detail - that copies the value of the detail into $1, which you can then use as you see fit.
(The reply seems to have been lost, so I'm sending it again, with some edits)
Hi!
Are you sure it works with aliases? I have tried putting it in my sieve, but for me it works only for "user+detail", i.e. when I use an actually existing user name + detail. If I use an "alias+detail", the message is still dropped into INBOX.
And I guess I now understand why: when a message is trancferred by dovecot-lmtp from an alias to the end user, it loses its detail part of the "Envelope-To". The detail part of the address is preserved only in the header "To".
So there are two questions:
- Is there a way to make dovecot-lmtp preserve the detail part of the address in the envelope?
or
- Is there a way to cut a part of the address from the header "To"? I mean, cut the part between the + and the @ and use this part as a variable for fileinto. I have tried this:
if header :matches "to" "+(*)@" { fileinto :create "Tagged/${1}"; stop; }
but the message is still dropped into INBOX.
-- Respectfully, Denis Shadrin
On 2021-02-18 2:23 p.m., ml@shadrinden.ru wrote:
So there are two questions:
- Is there a way to make dovecot-lmtp preserve the detail part of the address in the envelope?
or
- Is there a way to cut a part of the address from the header "To"? I mean, cut the part between the + and the @ and use this part as a variable for fileinto. I have tried this:
if header :matches "to" "+(*)@" { fileinto :create "Tagged/${1}"; stop; }
but the message is still dropped into INBOX.
Just to ask - when you say 'alias' do you mean something is re-writing the address based on some rule? If so, it sounds to me like that is dropping the +detail...
-- Daryl Richards Isle Technical Services Inc.
On Thu, 18 Feb 2021 14:36:01 -0500 Daryl Richards daryl@isletech.net wrote:
Just to ask - when you say 'alias' do you mean something is re-writing the address based on some rule? If so, it sounds to me like that is dropping the +detail...
I mean the aliases defined in /etc/aliases, like
jane: joe
-- Respectfully, Denis Shadrin
On 2021-02-18 2:46 p.m., ml@shadrinden.ru wrote:
On Thu, 18 Feb 2021 14:36:01 -0500 Daryl Richards daryl@isletech.net wrote:
Just to ask - when you say 'alias' do you mean something is re-writing the address based on some rule? If so, it sounds to me like that is dropping the +detail...
I mean the aliases defined in /etc/aliases, like
jane: joe
Do you have propagate_unmatched_extensions turned on?
http://www.postfix.org/aliases.5.html shows that has to be on otherwise it could drop the +detail part...
-- Daryl Richards Isle Technical Services Inc.
On Thu, 18 Feb 2021 14:57:19 -0500 Daryl Richards daryl@isletech.net wrote:
Do you have propagate_unmatched_extensions turned on?
http://www.postfix.org/aliases.5.html shows that has to be on otherwise it could drop the +detail part...
On my machine it is by default set to
propagate_unmatched_extensions = canonical, virtual
According to man pages, the behavior of these values (canonical and virtual) in this regard seems to be identical:
" When a mail address localpart contains the optional recipient delimiter (e.g., user+foo@domain), the lookup order becomes: user+foo@domain, user@domain, user+foo, user, and @domain."
-- Respectfully, Denis Shadrin
Could it be postfix's cleanup / trivial-rewrite getting in the way and rewriting headers ?
Yassine -- admin sysweb.
Le 2/18/21 à 9:10 PM, ml@shadrinden.ru a écrit :
On Thu, 18 Feb 2021 14:57:19 -0500 Daryl Richards daryl@isletech.net wrote:
Do you have propagate_unmatched_extensions turned on?
http://www.postfix.org/aliases.5.html shows that has to be on otherwise it could drop the +detail part... On my machine it is by default set to
propagate_unmatched_extensions = canonical, virtual
According to man pages, the behavior of these values (canonical and virtual) in this regard seems to be identical:
" When a mail address localpart contains the optional recipient delimiter (e.g., user+foo@domain), the lookup order becomes: user+foo@domain, user@domain, user+foo, user, and @domain."
-- Respectfully, Denis Shadrin
Did you disable enable_original_recipient and have postfix <= 3.2 ? (I had to do this for a deduplication problem)
http://www.postfix.org/postconf.5.html#enable_original_recipient
Yassine -- admin sysweb.
Le 2/21/21 à 10:22 AM, Yassine Chaouche a écrit :
Could it be postfix's cleanup / trivial-rewrite getting in the way and rewriting headers ?
Yassine -- admin sysweb.
Le 2/18/21 à 9:10 PM, ml@shadrinden.ru a écrit :
On Thu, 18 Feb 2021 14:57:19 -0500 Daryl Richards daryl@isletech.net wrote:
Do you have propagate_unmatched_extensions turned on?
http://www.postfix.org/aliases.5.html shows that has to be on otherwise it could drop the +detail part... On my machine it is by default set to
propagate_unmatched_extensions = canonical, virtual
According to man pages, the behavior of these values (canonical and virtual) in this regard seems to be identical:
" When a mail address localpart contains the optional recipient delimiter (e.g., user+foo@domain), the lookup order becomes: user+foo@domain, user@domain, user+foo, user, and @domain."
-- Respectfully, Denis Shadrin
On Sun, 21 Feb 2021 10:28:41 +0100 Yassine Chaouche a.chaouche@algerian-radio.dz wrote:
Did you disable enable_original_recipient and have postfix <= 3.2 ? (I had to do this for a deduplication problem)
http://www.postfix.org/postconf.5.html#enable_original_recipient
Yassine -- admin sysweb.
Le 2/21/21 à 10:22 AM, Yassine Chaouche a écrit :
Could it be postfix's cleanup / trivial-rewrite getting in the way and rewriting headers ?
No, enable_original_recipient is set to "yes", and postfix version is 3.3.0.
Well, I got the needed behavior by using a sieve with address and regex.
-- Respectfully, Denis Shadrin
On Thu, 18 Feb 2021 13:27:34 +0100 Bjoern Franke bjo@schafweide.org wrote:
Hi,
So, there is now way that Dovecot can create folders with "detail" name for mail sent to "alias+detail" address?
did you take a look into the logs? E.g. in my setup, dovecot complains when sieve should put the message into a folder which does not exist.
Maybe it logs something also in your case why it does not create the folder.
Regards Bjoern
Hi!
I'm sorry I didn't word it more clearly. The problem is not with creating folders, just with putting messages into them. If I send a message to "user+detail", the "detail" folder is created just fine, and the message is put there. Problems are axactly with one use case: when I send a message to "alias+detail". In that case it is just put into INBOX regardless of whatever I try to define in sieves with ":detail" rule.
-- Respectfully, Denis Shadrin
On Thu, 18 Feb 2021 13:27:34 +0100 Bjoern Franke bjo@schafweide.org wrote:
Hi,
So, there is now way that Dovecot can create folders with "detail" name for mail sent to "alias+detail" address?
did you take a look into the logs? E.g. in my setup, dovecot complains when sieve should put the message into a folder which does not exist.
Maybe it logs something also in your case why it does not create the folder.
Regards Bjoern
Hi!
I'm sorry I didn't word it more clearly. The problem is not with creating folders, just with putting messages into them. If I send a message to "user+detail", the "detail" folder is created just fine, and the message is put there. Problems are axactly with one use case: when I send a message to "alias+detail". In that case it is just put into INBOX regardless of whatever I try to define in sieves with ":detail" rule.
-- Respectfully, Denis Shadrin
On 2021-02-18 7:19 a.m., ml@shadrinden.ru wrote:
So, there is now way that Dovecot can create folders with "detail" name for mail sent to "alias+detail" address? Have you checked the dovecot settings for lmtp_save_to_detail_mailbox and recipient_delimiter?
https://doc.dovecot.org/settings/core/#lmtp-save-to-detail-mailbox
-- Daryl Richards Isle Technical Services Inc.
On Thu, 18 Feb 2021 08:44:30 -0500 Daryl Richards daryl@isletech.net wrote:
On 2021-02-18 7:19 a.m., ml@shadrinden.ru wrote:
So, there is now way that Dovecot can create folders with "detail" name for mail sent to "alias+detail" address?
Have you checked the dovecot settings for lmtp_save_to_detail_mailbox and recipient_delimiter?https://doc.dovecot.org/settings/core/#lmtp-save-to-detail-mailbox
Hi!
Yes, I have "lmtp_save_to_detail_mailbox = yes" and recipient_delimiter set to +. Everything is working as long as I send a message to "user+detail", i.e. to an existing user. The problems start when I try to send to a combination of an alias and a detail: "alias+detail". Then the message is just put into INBOX of the respective user regardless of what I try to define in sieves with ":detail" rule.
-- Respectfully, Denis Shadrin
participants (7)
-
Anton Dollmaier
-
Bjoern Franke
-
Darac Marjal
-
Daryl Richards
-
ml@shadrinden.ru
-
Postmaster
-
Yassine Chaouche