bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-mailutils] Scheme procedure mu-message-copy


From: Sergey Poznyakoff
Subject: Re: [bug-mailutils] Scheme procedure mu-message-copy
Date: Wed, 06 Jun 2012 11:00:32 +0300

Chris Hall <address@hidden> ha escrit:

> No, the intent is to move it from inbox to folder.

Aha, then something along these lines should do:

(use-modules (mailutils mailutils))
(let ((source-mbox (mu-mailbox-open "mbox:///home/gray/test-mbox/source" "rw"))
      ; Open dest mailbox. The "c" flags creates it if it does not exist.
      (dest-mbox (mu-mailbox-open "mbox:///home/gray/test-mbox/dest" "cwr")))
  ; Get the first message
  (let ((msg (mu-mailbox-get-message source-mbox 1)))
    ; Append it to the destination mailbox.
    (mu-mailbox-append-message dest-mbox msg)
    ; Get back the appended message and modify its header.
    ; Note the call to mu-mailbox-messages-count: apart from its
    ; mail purpose it also flushes the message cache, which is essential
    ; in this case.
    (let ((msg (mu-mailbox-get-message dest-mbox
                                       (mu-mailbox-messages-count dest-mbox))))
      (mu-message-set-header msg "X-Filed-By" "Guile" #t)))
  ; That's a bit of kludge: Guile API misses mu-mailbox-flush
  ; function. I'll add it ASAP. Meanwhile use this:
  (mu-mailbox-expunge dest-mbox)
  ; Close both mailboxes.
  (mu-mailbox-close dest-mbox)  
  (mu-mailbox-close source-mbox))

Regards,
Sergey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]