On 27 Sep 2015, at 19:10, Frank-Ulrich Sommer <[email protected]> wrote: > > Hello, > > I'm using dovecot with getmail and spamassassin. To re-learn false detected > mails I created two folders and use an external script that checks the > corresponding maildir directories for changes (with inotifywait). The mails > found in these directories are passed to sa-learn (to re-learn the correct > classification) and then moved back to the inbox or the spam folder. > > To access the mail I use "doveadm search" (to find all mails in the two > folders), "doveadm fetch" (to get the text and pass it to sa-learn) and > "doveadm move" (to move the mail to the correct location. > This works as desired, except that a mail once marked as spam will forever be > marked as such. Spamassassin has the -d option to remove the markup, but I > need to replace the original mail with the cleaned version. The only idea I > got was deleting that mail and importing the cleaned one, but as I want to > implement several "special" folders for further functionality with different > IMAP clients I would prefer a "cleaner" solution. > > What would be the correct/best way to modify the mail body/header/text from > an external tool?
IMAP protocol doesn't allow modifying messages. If they change, they need to get a new IMAP UID. So you'll need to use doveadm save + doveadm expunge to do this.
