nicm / fdm

fdm source code
269 stars 50 forks source link

Matching Regex doesn't always work when account type is a mbox in dos file #88

Closed foalford closed 3 years ago

foalford commented 3 years ago

This issue troubled me quite a bit.

account "import" disabled mbox "%h/my_exported_gmail.mbox" keep
account "stdin" disabled stdin
# omitted actions

match "^From:.*abc" action "another.maildir"

This isn't working via import account however it is when I try to pipe in the single email via stdin account. The culprit is the Google takeout mbox file is in dos format with CRLF. After trim the CR out of the file, it's working like a charm.

Although it may not worth a fix, it's good to leave a note here for someone having the similar situation.

nicm commented 3 years ago

Unless you actually have $ at the end of your regex then sounds like a bug in your regex engine, did you try using PCRE?

foalford commented 3 years ago

I don't have $ at the end. The example captured the regex. I use archlinux and fdm installed via pacman. Not sure how to specify the PCRE regex engine within fdm.

I was contributing to the information that may help someone else rather than reporting a bug. Please feel free to close this issue. And I like fdm. Great work!

While having your attention, may I consult you of a better solution to a situation as below:

When setting up multiple emails, which are common nowadays, and storing them separately, under various mutt's accounts for example, I want to reuse some rules and/or actions, such as spam filter and archives. FDM has to separate them into different config files and carefully include the common part because rules and actions have a global scope and may interfere. This also leads to multiple timers setup with specific config file as CLI argument (-f) for syncing those emails.

nicm commented 3 years ago

It is impossible to tell you how to organize your configs from so little information. Rules do not necessarily have global scope they can go inside other rules eg:


match account "x" {
     match whatever action maildir "mymaildir"
}
foalford commented 3 years ago

This helps. Didn't think of it. I am closing this issue and thanks for your tips.

match account "x" {
     match whatever action maildir "mymaildir"
}