> 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 .? 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. ?some random string? then trying to :match ?random? won?t match that string. ?*random*? *will* match (as will ?some*? and ?*string?). Like I said, I?m not 100% sure, but I suspect if you add * to the end: if address :matches ["To", "Cc"] ["*@*.*"] { It might work. Sean
> 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
On 23 Oct 2020, at 05:20, @lbutlr <kremels at kreme.com> wrote:>> 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,Excellent! That was the secret sauce! Thank you! -- Hard work pays off in the future. Laziness pays off now.
> On Oct 23, 2020, at 04:20, @lbutlr <kremels at kreme.com> wrote: >> 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 <mailto:user at example.com>"The question was meant to elucidate that the ?match? string ended with a ?.?. I understand what you?re trying to do.> 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:Perhaps (I am not sure if pigeonhole has it) the regex extension would be helpful: https://tools.ietf.org/id/draft-ietf-sieve-regex-01.html <https://tools.ietf.org/id/draft-ietf-sieve-regex-01.html>>> if address :matches ["To", "Cc"] ["*@*.*"] { > > Thanks for the advice, I will definitely give that a go,I?m unclear if the match line I supposed would set 1, 2 and 3, and you can ignore 3. Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://dovecot.org/pipermail/dovecot/attachments/20201023/2f8e338e/attachment.html>