Re: MIME, attachments, and few more things

"DINH Viêt Hoà" <[email protected]> Tue, 31 Jul 2007 01:01:37 +0200
Newsgroups gmane.mail.libetpan.user
Message-ID <[email protected]>
On 7/30/07, Matt Ronge <mronge-ePFkAnfr6dRWk0Htik3J/[email protected]> wrote:
> Hello,
>
> In a few areas of my code I use the lower level libetpan functions to
> pull data from the IMAP server. However, once I've pulled the data I
> still want to be able to use some of the high level functionality
> because of it's convenience.
>
> In particular, I do a mailimap_fetch, and then I use
> uid_list_to_env_list to convert my results to a mailmessage_list. In
> order to do this I've had to copy the uid_list_to_env_list code into
> my file. Would it be a good idea to expose some functionality in
> libetpan to make it easier to go from the lower level to the higher
> level? Would it be OK to expose uid_list_to_env_list?
>
> Another low level to high level function I've had to copy as well, is
> imap_flags_to_flags, would it be possible to expose something like this?
>
> What are your thoughts on this Hoa?

Sure, though, it would have to be renamed to
mail_imap_uid_list_to_env_list() and mail_imap_flags_to_flags() (or
given access through such functions).
(scheduling it for work this week-end)

> Another question, I noticed that in a number of places,
> mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); is used. Why is
> 8BIT always used? What if the client and server doesn't support 8BIT?

Could you give a detailed description of the place where it is used ?

> I've also been working on adding support in my code for sending
> attachments, and I'm a little bit confused. When I send text I use,
> mailmime_set_body_text, but now I want to send binary data. Can I
> still use mailmime_set_body_text? I can't seem to find another
> function to use in it's place. Of course, I also plan to use base64
> for my mime.

set_body_text() can also be used to attach binary data.
You have to give the length of the data you attach.

> Finally, is there any code in etpanX or in libetpan that is used to
> determine what MIME type should be used for an attachment? IE: Like if
> the file is *.jpg then it will know to use image/JPEG.

I have no code to do that.
/etc/mailcap is something more or less standard to do describe how to
choose a MIME type. Though, that's not used on Mac OS X.
On Mac OS X, maybe the following file could help:
/System/Library/Frameworks/Foundation.framework/Resources/types.plist

-- 
DINH Viêt Hoà

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/