Re: [gmime-devel] Help appreciated adding attachments to outgoing mails
- From: Jeffrey Stedfast <fejj gnome org>
- To: Steve Kemp <steve steve org uk>
- Cc: gmime-devel-list gnome org
- Subject: Re: [gmime-devel] Help appreciated adding attachments to outgoing mails
- Date: Sun, 11 Aug 2013 13:40:18 -0400
On 8/11/2013 12:18 PM, Steve Kemp wrote:
..
Having tried that I suspect something is going wrong, as the
resulting message is clearly bogus:
--
Subject: testing 3
From: Steve Kemp <steve steve org uk>
Content-Type: text/plain; charset=UTF-8
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-6d8Cd3fBeYCB69lh/Amd"
--=-6d8Cd3fBeYCB69lh/Amd
ontent-Type: text/plain; charset=UTF-8
MIME-Versio
--=-6d8Cd3fBeYCB69lh/Amd
Content-Type: application/octet-stream; name=fstab
Content-Disposition: attachment; filename=fstab
Content-Transfer-Encoding: base64
IyAvZXRjL2ZzdGFiOiBzdGF0aWMgZmlsZSBzeXN0ZW0gaW5mb3JtYXRpb24uCiMKIyBVc2UgJ2Js
--
Note the weird "ontent-Type" and the version not being quite right.
Are you by any chance writing the message into the same filename as you
parsed the simple message from?
That could explain this because, by default, for streams that are
seekable like GMimeStreamFs, the GMimeParser will keep the content on
disk and only load it on demand (i.e. when you go to write it out
somewhere). If you write to the same file on disk, then it'll be reading
and writing from the same file which could easily produce garbled output
like the above.
You can solve this in 2 ways:
1. g_mime_parser_set_persist_stream (parser, FALSE);
2. write to a temp file and then use rename() to rename it back to the
original filename.
If not, then it might be a bug in GMime... I'll have to investigate.
Jeff
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]