bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

extracting


From: Info Xwave
Subject: extracting
Date: Wed, 18 Dec 2002 17:51:35 +0100

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.

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!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]