I have an email with the following header line: From: 'Thank you!Kohls' <Kohls-MNc at FeedbackKohlsOpinionRequestedlxecrftHO.com> I am trying to match that with: if address :contains "from" "Thank you!Kohls" { addflag "\\Seen"; fileinto "Junk"; stop; } However, the matching portion of the from address is only the section between < and >. Since there are changing sections that are different for each email, I can't use that. I wanted to match the stuff before <. I have tried numerous formats for the if statement but none of them have worked. What is the proper way to make that match work? Thanks, -- Doug
On 9/30/22 15:14, Doug Hardie wrote:> I have an email with the following header line: > > From: 'Thank you!Kohls' <Kohls-MNc at FeedbackKohlsOpinionRequestedlxecrftHO.com> > > I am trying to match that with: > if address :contains "from" "Thank you!Kohls" > { > addflag "\\Seen"; > fileinto "Junk"; > stop; > } > > However, the matching portion of the from address is only the section between < and >. Since there are changing sections that are different for each email, I can't use that. I wanted to match the stuff before <. I have tried numerous formats for the if statement but none of them have worked. What is the proper way to make that match work? Thanks,I did what looked like the right thing in a sieve plugin for roundcube: https://www.dropbox.com/s/abhpc7rf9rokmfl/junk_rule_for_sieve.png?dl=0 And this is what that created in the script.? Only one word of difference from yours -- it looks at the entire From header and not an address. # rule:[testing] if header :contains "from" "Testing" { ??????? addflag "\\Seen"; ??????? fileinto "Junk"; ??????? stop; } Hope this helps. Thanks, Shawn
> On 30 September 2022, at 16:46, Shawn Heisey <elyograg at elyograg.org> wrote: > > On 9/30/22 15:14, Doug Hardie wrote: >> I have an email with the following header line: >> >> From: 'Thank you!Kohls' <Kohls-MNc at FeedbackKohlsOpinionRequestedlxecrftHO.com> >> >> I am trying to match that with: >> if address :contains "from" "Thank you!Kohls" >> { >> addflag "\\Seen"; >> fileinto "Junk"; >> stop; >> } >> >> However, the matching portion of the from address is only the section between < and >. Since there are changing sections that are different for each email, I can't use that. I wanted to match the stuff before <. I have tried numerous formats for the if statement but none of them have worked. What is the proper way to make that match work? Thanks, > > I did what looked like the right thing in a sieve plugin for roundcube: > > https://www.dropbox.com/s/abhpc7rf9rokmfl/junk_rule_for_sieve.png?dl=0 > > > And this is what that created in the script. Only one word of difference from yours -- it looks at the entire From header and not an address. > > # rule:[testing] > if header :contains "from" "Testing" > { > addflag "\\Seen"; > fileinto "Junk"; > stop; > } > > Hope this helps. >Thanks. That was the magic incantation I needed. -- Doug