Hi, Sergey, Just to be sure, shouldn't there be an mu-message-delete in there too?
I deliberately left it out of my example, which was more experimental than trying for production code (thats one of the things I love about Scheme/Lisp, how easy it is to fool around and try things.) But not being an expert in mail systems, I'd like to be sure: doesn't mu-message-delete flag a message for deletion without physically deleting it, while mu-mailbox-expunge _does_ delete those messages flagged as 'delete'? Thats my understanding, anyway. Sincerely, Chris On 06/05/2012 10:00 PM, Sergey Poznyakoff wrote: > Chris Hall <[email protected]> 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 _______________________________________________ Bug-mailutils mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-mailutils
