Index: plugins/prefer-plain/prefer-plain.c
===================================================================
--- plugins/prefer-plain/prefer-plain.c	(revision 35915)
+++ plugins/prefer-plain/prefer-plain.c	(working copy)
@@ -25,13 +25,15 @@
 GtkWidget *org_gnome_prefer_plain_config_mode(struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data);
 
 enum {
+	EPP_DISABLED = -1,
 	EPP_NORMAL,
 	EPP_PREFER,
-	EPP_TEXT
+	EPP_TEXT,
+	NUM_EPP_TYPES
 };
 
 static GConfClient *epp_gconf = NULL;
-static int epp_mode = -1;
+static int epp_mode = EPP_DISABLED;
 
 void
 org_gnome_prefer_plain_text_html(void *ep, EMFormatHookTarget *t)
@@ -39,8 +41,14 @@
 	/* In text-only mode, all html output is suppressed */
 	if (epp_mode != EPP_TEXT)
 		t->item->handler.old->handler(t->format, t->stream, t->part, t->item->handler.old);
-	else
+	else {
+		if (!camel_mime_part_get_filename (t->part)) {
+			char *str = g_strdup_printf ("%s.html", _("attachment"));
+			camel_mime_part_set_filename (t->part, str);
+			g_free (str);
+		}
 		em_format_part_as(t->format, t->stream, t->part, NULL);
+	}
 }
 
 static void
@@ -76,7 +84,10 @@
 						g_free (str);
 					}
 
-					em_format_part_as (format, stream, part, "application/octet-stream");
+					if (epp_mode != EPP_TEXT)
+						em_format_part_as (format, stream, part, "application/octet-stream");
+					else
+						em_format_part_as (format, stream, part, NULL);
 				} else
 					em_format_part (format, stream, part);
 
@@ -180,8 +191,8 @@
 epp_mode_changed(GtkComboBox *dropdown, void *dummy)
 {
 	epp_mode = gtk_combo_box_get_active(dropdown);
-	if (epp_mode > 2)
-		epp_mode = 0;
+	if (epp_mode >= NUM_EPP_TYPES)
+		epp_mode = EPP_NORMAL;
 
 	gconf_client_set_string(epp_gconf, "/apps/evolution/eplugin/prefer_plain/mode", epp_options[epp_mode].key, NULL);
 }
@@ -236,7 +247,7 @@
 	char *key;
 	int i;
 
-	if (epp_gconf || epp_mode != -1)
+	if (epp_gconf || epp_mode != EPP_DISABLED)
 		return 0;
 
 	if (enable) {
@@ -251,7 +262,7 @@
 			}
 			g_free (key);
 		} else {
-			epp_mode = 0;
+			epp_mode = EPP_NORMAL;
 		}
 	} else {
 		if (epp_gconf) {
Index: plugins/prefer-plain/ChangeLog
===================================================================
--- plugins/prefer-plain/ChangeLog	(revision 35915)
+++ plugins/prefer-plain/ChangeLog	(working copy)
@@ -1,3 +1,15 @@
+2008-08-06  Paul Bolle  <pebolle@tiscali.nl>
+
+	** Fix for bug #5...
+
+	* prefer-plain.c: Add EPP_DISABLED and NUM_EPP_TYPES to the enum and
+	actually use the constants defined in the enum wherever we can.
+	* prefer-plain.c: (org_gnome_prefer_plain_text_html): Also use
+	"attachment.html" in text only mode.
+	* prefer-plain.c: (export_as_attachments): format html/text part as
+	NULL in text only mode, so it will directly end up as an unknown
+	attachment .
+
 2008-05-27  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #532384
