Re: MIME, attachments, and few more things

Matt Ronge <mronge-ePFkAnfr6dRWk0Htik3J/[email protected]> Tue, 31 Jul 2007 00:04:55 -0700
Newsgroups gmane.mail.libetpan.user
Message-ID <[email protected]>
On Jul 30, 2007, at 4:01 PM, DINH Viêt Hoà wrote:
>>
>> 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)

Sounds great! I might try and play around with changing it too. I'd  
like to get more involved in libetpan and give a little bit back.

>
>> 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 saw it in two places:

mailmime_types_helper.c:1057


struct mailmime * mailmime_multiple_new(const char * type)
{
   struct mailmime_fields * mime_fields;
   struct mailmime_content * content;
   struct mailmime * mp;

   mime_fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
   if (mime_fields == NULL)
     goto err;

   content = mailmime_content_new_with_str(type);
   if (content == NULL)
     goto free_fields;

   mp = mailmime_new_empty(content, mime_fields);
   if (mp == NULL)
     goto free_content;

   return mp;

  free_content:
   mailmime_content_free(content);
  free_fields:
   mailmime_fields_free(mime_fields);
  err:
   return NULL;
}


I also saw it in some of the etpanX code,
etpan-message-composer.c:254

Code is similar to the above snippet. Is it ok to always use 8BIT like  
that?


>
>> 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.

Excellent. I just wanted to double check.

>
>> 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

I wonder why /etc/mailcap isn't used in Mac OS X?

--
Matt Ronge

-------------------------------------------------------------------------
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/

_______________________________________________
Libetpan-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libetpan-users