2

At work we have a limited storage quota on the email server so I have set up Dovecot on my laptop as an email archive that I also access using IMAP. Besides archiving I also store all email from mailing lists on the local server.

Recently I have been trying to rid myself of Thunderbird and use Emacs for all emailing and as part of that I have migrated my filter rules to nnmail-split-fancy rules. However, so far I have not been able to get nnmail to successfully move email from my inbox (company IMAP) to my archive (local Dovecot IMAP), is this at all possible to do?

My configuration looks something like this:

(add-to-list
 'gnus-secondary-select-methods
 '(nnimap "[email protected]"
          ...))
(add-to-list
 'gnus-secondary-select-methods
 '(nnimap "[email protected]"
          ...))

(setq
 nnimap-split-methods 'nnmail-split-fancy
 nnimap-split-download-body-default t
 nnmail-split-fancy
 '(|
   (: nnmail-split-fancy-with-parent)
   (list ".*linux-users.*"
         "[email protected]:Mailing Lists.Linux Users")))

I also tried appending "nnimap+" to the destination and various other combinations but every time an email matches the rule Gnus will simply create a folder called [email protected]:Mailing Lists.Linux Users on the company IMAP server and move the email there instead of going to my local server.

My complete Gnus configuration, except for machine local settings, is available here.

2 Answers 2

2

Gnus splitting does not work across servers.

I would recommend instead to treat your company IMAP server as a mail source, as described in https://www.gnu.org/software/emacs/manual/html_node/gnus/Mail-Source-Specifiers.html

You can still keep using it in your gnus-secondary-select-methods as far as I know.

2
  • If I treat it as a mail source will it pop my email from the IMAP server? I really need to keep "current" email threads on the server as a backup and so that I can access it over the web in an emergency.
    – David Holm
    Feb 5, 2015 at 9:40
  • Look at the page I cited. The :predicate, :fetchflag, and :dontexpunge options will help. Feb 5, 2015 at 14:04
0

I know this is an old question, but it came up for me recently, and no, you cannot split across IMAP servers.

I didn't want to set the one server as just as a mail source, as then I would only be able to fetch from a single folder (i.e. INBOX), or else I'd have to set up multiple sources for multiple folders.

So what I did was write a function that, after finding mail on the second server, would move it to the other server. Not split, but move. It is perfectly possible to move mail between servers with gnus commands.

Here is an example, I hope it renders correctly.

(defun rjn-move-mail-between-groups ()
  "Move between mailboxes based probably on foreign servers"
  (interactive)
  ;; Simplest to add additional moves below this point.
  (rjn-do-mail-move "nnimap+aol:INBOX" "nnimap+imap.gmail.com:INBOX")
)

(defun rjn-do-mail-move (frombox tobox)
  "Move mail between mailboxes, even if between different IMAP 
   servers"
  (save-window-excursion
  (if (get-buffer "*Group*")
      (with-current-buffer "*Group*"
     (if (gnus-group-goto-group frombox t)
           (if (or (gnus-group-select-group) (gnus-topic-select-group))
           (progn
             (gnus-uu-mark-buffer)
             (gnus-summary-move-article nil tobox nil)
             (gnus-summary-catchup t t)
             (gnus-summary-exit)))))))
)

(add-hook 'gnus-after-getting-new-news-hook 'rjn-move-mail-between-groups)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.