unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* noticed mailutils (specifically guimb) -- kinda interesting.
@ 2002-07-21  6:53 Rob Browning
  0 siblings, 0 replies; only message in thread
From: Rob Browning @ 2002-07-21  6:53 UTC (permalink / raw)



For those who haven't seen it before, I believe it's intended to be a
standard C email handling library, but the interesting guile related
bit is guimb, which allows you to manipulate mail via guile scripts.
For example:

  $ cat mail-summary.scm
  (let ((mbox #f))
    (dynamic-wind
        (lambda () (set! mbox (mu-mailbox-open "/var/mail/rlb" "r")))
        (lambda ()
          (display mbox) (newline)
          (let ((count (mu-mailbox-messages-count mbox)))
            (do ((n 1 (+ n 1)))
                ((> n count))
              (let* ((msg (mu-mailbox-get-message mbox n))
                     (hdrs (mu-message-get-header-fields msg '("From"
                                                               "Subject"))))

                (simple-format #t "Subject: ~A\n" (assoc-ref hdrs "Subject"))
                (simple-format #t "  From: ~A\n" (assoc-ref hdrs "From"))
                (simple-format #t "  Size: ~A\n"
                               (mu-message-get-size msg))))))
        (lambda () (mu-mailbox-close mbox))))

  $ guimb -f mail-summary.scm
  #<mailbox /var/mail/rlb (5)>
  Subject: some msg...
    From: bar@bar.bar (Bar Bar)
    Size: 7453
  Subject: some other message
    From: Ed Foo <foo@foo.foo>
    Size: 3881

If I get the time, I might see if they'd be interested in a patch to
provide support for (use-modules (mailutils)).  Hmm.  Looks like
mailutils should probably be added to the guile projects list too.

-- 
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C  64AE 78FE E5FE F0CB A0AD

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-07-21  6:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-21  6:53 noticed mailutils (specifically guimb) -- kinda interesting Rob Browning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).