[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: extracting
From: |
Alain Magloire |
Subject: |
Re: extracting |
Date: |
Wed, 18 Dec 2002 12:13:42 -0500 (EST) |
>
<off topic>
Is there a way, to set the subject of the mails and prepend
[mailutils] or something to the subject, whith the current
mailing list on gnu. Lots of message goes unnoticed, because
the subject.
</off topic>
> I doing my first steps with MailUtils and have some newbie
> difficulties...
>
> I simply want to read a mail file from disk and modify its
> attachments (remove, add).
>
> Therefore, I started with some very basic code, like:
>
> message_create(&msg, NULL);
>
> // first, only want to read...
> file_stream_create(&fileStream, fileName, MU_STREAM_READ);
> stream_open(fileStream);
>
> message_set_stream(msg, fileStream, NULL);
>
> // read some header fields...
> message_get_header(msg, &header);
> header_get_value(header, MU_HEADER_FROM, mailFrom, sizeof(mailFrom), NULL);
> header_get_value(header, MU_HEADER_SUBJECT, mailSubject,
> sizeof(mailSubject), NULL);
>
> ...so far, so good...
>
> now I want to know if there are any attachments to be processed.
> For this I call
>
> // get number of attachements...
> message_get_num_parts(msg, &numParts);
>
> Unfortunately, I always get the result numParts = 0.
>
I've copy your code and it seems to work ok.
I've got numParts return 2.
Is you email message properly format ? with :
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_007A_01C2A5DF.D9BCBBF0"
> In the example directory i saw mimetest.c which does quite the same, but
> only
> obtains the message from a mailbox.
>
> Am I wrong that the whole message stream should be read and parsed with
> message_get_num_parts in order to obtain the count of parts?
> Should I take an other approach (read whole message into memory)?
>
> Thanks for any help!
- extracting, Info Xwave, 2002/12/18
- Re: extracting,
Alain Magloire <=