woolshum | 1 Nov 2007 04:31

MIME parse error??

Hi guys,
I use libetpan-0.52 and sample code to receive mail, but this mail seem like parse error
because I can see full mail content in web mailbox, but use sample code, it only parse to a few characters
attachment is this MIME file of this mail, any body could see whats happen?


Check Out the new free AIM(R) Mail -- Unlimited storage and industry-leading spam and email virus protection.
Attachment (MIMEFILE): application/octet-stream, 30 KiB
-------------------------------------------------------------------------
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
Libetpan-users@...
https://lists.sourceforge.net/lists/listinfo/libetpan-users
woolshum | 1 Nov 2007 09:25

mail of MIME parse error??

Hi guys,
I use libetpan-0.52 and sample code to receive mail, but this mail seem like parse error
because I can see full mail content in web mailbox, but use sample code, it only parse to a few characters
attachment is this MIME file of this mail, any body could see whats happen?

Thank you for your help: )
Check Out the new free AIM(R) Mail -- Unlimited storage and industry-leading spam and email virus protection.
Attachment (MIMEFILE): application/octet-stream, 29 KiB
-------------------------------------------------------------------------
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
Libetpan-users@...
https://lists.sourceforge.net/lists/listinfo/libetpan-users
DINH Viêt Hoà | 1 Nov 2007 12:58
Picon
Favicon

Re: MIME parse error??

On 11/1/07, woolshum@... <woolshum@...> wrote:
> Hi guys,
>  I use libetpan-0.52 and sample code to receive mail, but this mail seem
> like parse error
>  because I can see full mail content in web mailbox, but use sample code, it
> only parse to a few characters
>  attachment is this MIME file of this mail, any body could see whats happen?

Hello,

It looks like in the multipart message, one boundary is the prefix of the other.
This will make libetpan fails to parse the message.
I'll fix this.

=_NextPart_xUB0vL5OwuHGJtwGp64jQzFgQcNZsAA
=_NextPart_xUB0vL5OwuHGJtwGp64jQzFgQcNZs

Thanks for the bugreport.

--

-- 
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/
DINH Viêt Hoà | 3 Nov 2007 17:06
Picon
Favicon

Re: MIME parse error??

On 11/1/07, DINH Viêt Hoà <dinh.viet.hoa@...> wrote:
> On 11/1/07, woolshum@... <woolshum@...> wrote:
> > Hi guys,
> >  I use libetpan-0.52 and sample code to receive mail, but this mail seem
> > like parse error
> >  because I can see full mail content in web mailbox, but use sample code, it
> > only parse to a few characters
> >  attachment is this MIME file of this mail, any body could see whats happen?
>
> Hello,
>
> It looks like in the multipart message, one boundary is the prefix of the other.
> This will make libetpan fails to parse the message.
> I'll fix this.
>
> =_NextPart_xUB0vL5OwuHGJtwGp64jQzFgQcNZsAA
> =_NextPart_xUB0vL5OwuHGJtwGp64jQzFgQcNZs
>
> Thanks for the bugreport.

Hello,

I fixed this bug in the CVS.
This should be working now.

--

-- 
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/
Stanislaw T. Findeisen | 10 Nov 2007 08:35
Picon
Picon
Favicon

mailmime_write - col parameter

int mailmime_write(FILE * f, int * col,
		   struct mailmime * build_info);

What is this col parameter? In my documentation it is described as:

"col current column is given for wrapping purpose in (* col), the 
resulting columns will be returned.."

Should I be concerned about this in top-level call? Is it enough to call 
this function once for given FILE* and struct mailmime*?

STF

-------------------------------------------------------------------------
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/
Stanislaw T. Findeisen | 10 Nov 2007 07:53
Picon
Picon
Favicon

How to send MIME messages via SMTP using libetpan?

Hello,

I am trying to send a MIME message over SMTP. This MIME message can 
contain several attachments etc.

The problem I have is that MIME writing functions take only file 
descriptors as their output destinations. Right? For instance this one:

	int mailmime_write(FILE * f, int * col,
			   struct mailmime * build_info);

This seems to be somewhat incompatible with SMTP functions:

	int mailsmtp_data_message(mailsmtp * session,
         	                   const char * message,
                 	           size_t size);

The question is: how to send MIME message via SMTP? Do I have to make 
this file descriptor --> string conversion myself?

Thanks.

STF

-------------------------------------------------------------------------
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/
DINH Viêt Hoà | 10 Nov 2007 09:52
Picon
Favicon

Re: How to send MIME messages via SMTP using libetpan?

On 11/10/07, Stanislaw T. Findeisen
<sf181257@...> wrote:
> Hello,
>
> I am trying to send a MIME message over SMTP. This MIME message can
> contain several attachments etc.
>
> The problem I have is that MIME writing functions take only file
> descriptors as their output destinations. Right? For instance this one:
>
>         int mailmime_write(FILE * f, int * col,
>                            struct mailmime * build_info);
>
> This seems to be somewhat incompatible with SMTP functions:
>
>         int mailsmtp_data_message(mailsmtp * session,
>                                    const char * message,
>                                    size_t size);
>
> The question is: how to send MIME message via SMTP? Do I have to make
> this file descriptor --> string conversion myself?

Hello,

You have both functions to convert to strings and to file descriptor.

http://dinh.viet.hoa.free.fr/wiki/index.php?title=Mailmime_Generating_Messages

Regards,

--

-- 
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/
DINH Viêt Hoà | 10 Nov 2007 09:55
Picon
Favicon

Re: mailmime_write - col parameter

On 11/10/07, Stanislaw T. Findeisen
<sf181257@...> wrote:
> int mailmime_write(FILE * f, int * col,
>                    struct mailmime * build_info);
>
> What is this col parameter? In my documentation it is described as:
>
> "col current column is given for wrapping purpose in (* col), the
> resulting columns will be returned.."
>
> Should I be concerned about this in top-level call? Is it enough to call
> this function once for given FILE* and struct mailmime*?

Hello,

You should fill the given integer with a zero value and pass the
address to the mailmime_write() function.

void write_mime(FILE * f, struct mailmime * mime)
{
  int col;

  col = 0;
  mailmime_write(f, &col, mime);
}

--

-- 
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/
Stanislaw T. Findeisen | 10 Nov 2007 11:07
Picon
Picon
Favicon

line breaks in text attachments

Hello

I am experiencing problems with line breaks in text attachments. I wrote 
a sample program to demonstrate this problem:

=========================================================
/**
  * Based on compose-msg.c
  */

#include <stdlib.h>
#include <string.h>

#include <libetpan/libetpan.h>

struct mailimf_fields * build_fields() {
     const char * subject            = "line breaks";

     struct mailimf_mailbox_list * from = mailimf_mailbox_list_new_empty();
     struct mailimf_address_list * to = mailimf_address_list_new_empty();

     mailimf_mailbox_list_add_parse(from, "DINH Viet Hoa 
<hoa@...>");
     mailimf_address_list_add_parse(to, "Paul <claws@...>");

     struct mailimf_fields * new_fields = mailimf_fields_new_with_data(from,
         NULL, NULL, to, NULL, NULL, NULL, NULL, strdup(subject));
     return new_fields;
}

int main(int argc, char ** argv) {
     const char * attachmentFilename = "file-1.txt";
     const char * sampleText1        = "ab\ncd";
     const char * sampleText1Charset = "iso-8859-1";
     const int    sampleText1Length  = strlen(sampleText1);

     printf("Sample text length is: %d\n", sampleText1Length);
     printf("Sample text is: %s\n", sampleText1);

     // start the message
     struct mailimf_fields * fields = build_fields();
     struct mailmime * message = mailmime_new_message_data(NULL);
     mailmime_set_imf_fields(message, fields);

     // build attachment
     struct mailmime_fields * mime_fields = 
mailmime_fields_new_filename(MAILMIME_DISPOSITION_TYPE_ATTACHMENT, 
strdup(attachmentFilename), MAILMIME_MECHANISM_QUOTED_PRINTABLE);
     struct mailmime_content * mime_content = 
mailmime_content_new_with_str("text/plain");
     struct mailmime_parameter * mime_param = 
mailmime_param_new_with_data("charset", strdup(sampleText1Charset));
     clist_append(mime_content->ct_parameters, mime_param);

     struct mailmime * mime_sub = mailmime_new_empty(mime_content, 
mime_fields);
     mailmime_set_body_text(mime_sub, strdup(sampleText1), 
sampleText1Length);

     // add attachment to the message
     mailmime_smart_add_part(message, mime_sub);

     // write the message out
     printf("==== Printing the message:\n\n");
     int col = 0;
     mailmime_write(stdout, &col, message);
     mailmime_free(message);
     printf("#DONE\n");

     return 0;
}
=========================================================

The output of this program on my computer is:

=========================================================
Sample text length is: 5
Sample text is: ab
cd
==== Printing the message:

Date: Sat, 10 Nov 2007 10:57:56 +0100
From: DINH Viet Hoa <hoa@...>
To: Paul <claws@...>
Message-ID: <etPan.473580a4.6b8b4567.2ecb <at> thinkpad>
Subject: line breaks
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="file-1.txt"

ab
#DONE
=========================================================

It seems that the last line is cut out.

When using "sample text\nwith\nseveral\nlines." as a sample text, the 
last line is being cut also.

With different encodings like utf-8 the problem was the same.

Am I doing anything wrong, or is this a bug?

Thanks.

STF
Attachment (etpan-test-1.tgz): application/x-gtar, 1058 bytes
-------------------------------------------------------------------------
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
Libetpan-users@...
https://lists.sourceforge.net/lists/listinfo/libetpan-users
Stanislaw T. Findeisen | 10 Nov 2007 11:46
Picon
Picon
Favicon

Re: line breaks in text attachments

Well, when there is no Content-Disposition header at all, the problem 
seems to be the same.

Dinh, if you know how to fix it please tell me that and include that fix 
in next release.

Stanislaw T. Findeisen wrote:
> Hello
> 
> I am experiencing problems with line breaks in text attachments. I wrote 
> a sample program to demonstrate this problem:
> 
> =========================================================
> /**
>  * Based on compose-msg.c
>  */
> 
> #include <stdlib.h>
> #include <string.h>
> 
> #include <libetpan/libetpan.h>
> 
> struct mailimf_fields * build_fields() {
>     const char * subject            = "line breaks";
> 
>     struct mailimf_mailbox_list * from = mailimf_mailbox_list_new_empty();
>     struct mailimf_address_list * to = mailimf_address_list_new_empty();
> 
>     mailimf_mailbox_list_add_parse(from, "DINH Viet Hoa 
> <hoa@...>");
>     mailimf_address_list_add_parse(to, "Paul <claws@...>");
> 
>     struct mailimf_fields * new_fields = mailimf_fields_new_with_data(from,
>         NULL, NULL, to, NULL, NULL, NULL, NULL, strdup(subject));
>     return new_fields;
> }
> 
> int main(int argc, char ** argv) {
>     const char * attachmentFilename = "file-1.txt";
>     const char * sampleText1        = "ab\ncd";
>     const char * sampleText1Charset = "iso-8859-1";
>     const int    sampleText1Length  = strlen(sampleText1);
> 
>     printf("Sample text length is: %d\n", sampleText1Length);
>     printf("Sample text is: %s\n", sampleText1);
> 
>     // start the message
>     struct mailimf_fields * fields = build_fields();
>     struct mailmime * message = mailmime_new_message_data(NULL);
>     mailmime_set_imf_fields(message, fields);
> 
>     // build attachment
>     struct mailmime_fields * mime_fields = 
> mailmime_fields_new_filename(MAILMIME_DISPOSITION_TYPE_ATTACHMENT, 
> strdup(attachmentFilename), MAILMIME_MECHANISM_QUOTED_PRINTABLE);
>     struct mailmime_content * mime_content = 
> mailmime_content_new_with_str("text/plain");
>     struct mailmime_parameter * mime_param = 
> mailmime_param_new_with_data("charset", strdup(sampleText1Charset));
>     clist_append(mime_content->ct_parameters, mime_param);
> 
>     struct mailmime * mime_sub = mailmime_new_empty(mime_content, 
> mime_fields);
>     mailmime_set_body_text(mime_sub, strdup(sampleText1), 
> sampleText1Length);
> 
>     // add attachment to the message
>     mailmime_smart_add_part(message, mime_sub);
> 
>     // write the message out
>     printf("==== Printing the message:\n\n");
>     int col = 0;
>     mailmime_write(stdout, &col, message);
>     mailmime_free(message);
>     printf("#DONE\n");
> 
>     return 0;
> }
> =========================================================
> 
> The output of this program on my computer is:
> 
> =========================================================
> Sample text length is: 5
> Sample text is: ab
> cd
> ==== Printing the message:
> 
> Date: Sat, 10 Nov 2007 10:57:56 +0100
> From: DINH Viet Hoa <hoa@...>
> To: Paul <claws@...>
> Message-ID: <etPan.473580a4.6b8b4567.2ecb <at> thinkpad>
> Subject: line breaks
> MIME-Version: 1.0
> Content-Type: text/plain; charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
> Content-Disposition: attachment; filename="file-1.txt"
> 
> ab
> #DONE
> =========================================================
> 
> It seems that the last line is cut out.
> 
> When using "sample text\nwith\nseveral\nlines." as a sample text, the 
> last line is being cut also.
> 
> With different encodings like utf-8 the problem was the same.
> 
> Am I doing anything wrong, or is this a bug?
> 
> Thanks.
> 
> STF

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

Gmane