guile-user
[Top][All Lists]
Advanced

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

noticed mailutils (specifically guimb) -- kinda interesting.


From: Rob Browning
Subject: noticed mailutils (specifically guimb) -- kinda interesting.
Date: Sun, 21 Jul 2002 01:53:58 -0500
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-pc-linux-gnu)

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: address@hidden (Bar Bar)
    Size: 7453
  Subject: some other message
    From: Ed Foo <address@hidden>
    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



reply via email to

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