Sieve_before
@lbutlr
kremels at kreme.com
Fri Oct 23 14:20:03 EEST 2020
> On 22 Oct 2020, at 18:22, Sean Kamath <kamath at moltingpenguin.com> wrote:
>
>
>
>> On Oct 22, 2020, at 15:58, @lbutlr <kremels at kreme.com> wrote:
>>
>> On 22 Oct 2020, at 15:46, @lbutlr <kremels at kreme.com> wrote:
>>> And it doesn't explain why "if address :matches ["To", "Cc"] ["*@*."] {" also failed to match despite also showing the email address.
>>>
>>>> “kremels at kreme.com” does not have a :detail part (https://wiki2.dovecot.org/Pigeonhole/Sieve/Examples talks about this).
>>>
>>> And I am not asking for :detail
>>
>> OK, fair enough. I looked at that line many times for some reason.
>> But the first point still stand.
>
> Does you To or CC address end with a .?
No, what I am trying to get is "user" and "example" in "user at example.com"
> One problem I had with :matches (if I recall correctly, I can’t find where I ran into this) is that :matches has an implicit “^” and “$” wrapped around what you’re looking for.
That would break many things, but I will look into it. What I have done for now and is working is a much more complicated process where I am manually removing the '@' myself:
require ["copy", "variables", "envelope", "fileinto", "subaddress"];
if not envelope :matches "to" "backup" {
if envelope :matches "to" "*" {
set :lower "name" "${1}";
if string :matches "${name}" "*@*" {
set "email" "${1}_${2}";
}
# Only replaces one '.' But that's OK at this point.
if string :matches "${email}" "*.*" {
set "name" "${1}_${2}";
}
set "backup" "backup+296.${name}@...";
redirect :copy "${backup}";
}
else {
redirect :copy "backup+296 at ...";
}
}
This properly redirects a copy of the message to, for example, backup+296.kremels_kreme_com at ...
If all goes well, the 'else' will never trigger.
I will try your suggestion if the implicit ^$.
> Like I said, I’m not 100% sure, but I suspect if you add * to the end:
>
> if address :matches ["To", "Cc"] ["*@*.*"] {
Thanks for the advice, I will definitely give that a go,
--
Mister Teatime had a truly brilliant mind, but it was brilliant like
a fractured mirror, all marvelous facets and rainbows but,
ultimately, also something that was broken. --Hogfather
More information about the dovecot
mailing list