- GMimeStream *stream = g_mime_stream_file_new (stdout);
- g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream), FALSE);
+ GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
+ GMimeStream *stream_filter = NULL;
+
+ if (stream_stdout) {
+ g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
+ stream_filter = g_mime_stream_filter_new(stream_stdout);
+ g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
+ g_mime_filter_crlf_new(FALSE, FALSE));
+ }