[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mailutils questions - features and guile (perhaps the wrong list)
From: |
Sergey Poznyakoff |
Subject: |
Re: mailutils questions - features and guile (perhaps the wrong list) |
Date: |
Thu, 08 Aug 2002 10:28:37 +0300 |
Hi Rob,
> I poked around and didn't see any other lists regarding mailutils, so
> I thought I'd ask here. Please redirect me if this isn't the right
> place.
It's OK, you're writing to the right place.
> * If I had the time, would there be any interest in a mailutils
> guile module? i.e. (use-modules (mailutils)). The plan would be
> to create this module and convert guimb to just be a guile script
> that uses this module, i.e.:
>
Of course, it would be of great interest. Actually, libmu_scm was
planned as such a module. The only thing it lacks is module
initialization function. I was reluctant to implement it as a module,
since guile 1.4 and (would be) 1.6 have different conventions on init
functions. Using
scm_register_module_xxx ("util mailutils", init_mailutils);
will work with 1.4 but will not with 1.6. Is there any portable way that
will make it work with both versions?
As you may notice libmu_scm and guimb stuff is still oriented to 1.4,
I was planning to clean it up when 1.6 finally appeared (by the way
when is it going to be released?) Anyway, your efforts will be quite
welcome.
> * Are there any plans, or is there any interest in having functions
> at the scheme level (or the C level if they don't exist already)
> that let you grab the headers and the body of a message as raw
> strings? This is something I'd need for some scripts I was
> thinking about writing (i.e. I need to be able to get the message
> header and body verbatim -- with no modifications), and it didn't
> look like mailutils could do that at the moment. I'm thinking of
> something like libmail-box-perl's $msg->$head->toString() and
> $msg->body->string() methods.
There are several ways to get the message headers from Scheme. First,
you can use mu-message-get-header to return a particular header, e.g.:
(let ((hdr (mu-message-get-header message "Subject"))
....
Second, you can get a list of all (or a subset of all) headers, using
mu-message-get-header-fields, e.g.:
(let ((hdrlist (mu-message-get-header-fields message))
or
(let ((hdrlist (mu-message-get-header-fields
message
(list "From" "To" "Date" "Subject")))
Finally, you can get a port associated with the message and thus
access it in the row mode, e.g.:
(let ((port (mu_message_get_port message "r" #t)))
(do ((line (read-line port) (read-line port)))
...
There exist similar functions for accessing the body of the message.
> * Does mailutils already allow you to pass it a string to convert it
> to a message that you can then call normal mailutils functions on?
> If not, is there any interest in that functionality
Yes, it is possible. For example, sieve module guimb/scm/reject.scm
creates a multipart message from scratch and sends it to to the remote
party.
> (i.e. would patches be welcome if I had the time)?
Of course, your contributions will be highly welcome
Regards,
Sergey
PS: Coeterum censeo Guilem 1.6 releasem esse :)