diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index 6f9c84d..088c87f 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -302,16 +302,15 @@ pop3_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 	pop3_folder = CAMEL_POP3_FOLDER (folder);
 	pop3_store = CAMEL_POP3_STORE (folder->parent_store);
 
-	if (pop3_store->delete_after && !expunge) {
+	if (pop3_store->delete_after > 0 && !expunge) {
 		d(printf("%s(%d): pop3_store->delete_after = [%d], expunge=[%d]\n",
 			 __FILE__, __LINE__, pop3_store->delete_after, expunge));
 		camel_operation_start(NULL, _("Expunging old messages"));
 		camel_pop3_delete_old(folder, pop3_store->delete_after,ex);
 	}
 
-	if (!expunge) {
+	if (!expunge || (pop3_store->keep_on_server && !pop3_store->delete_expunged))
 		return;
-	}
 
 	camel_operation_start(NULL, _("Expunging deleted messages"));
 
@@ -663,6 +662,9 @@ pop3_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
 				uid, g_strerror (errno));
 		camel_object_unref (message);
 		message = NULL;
+	} else {
+		/* because the UID in the local store doesn't match with the UID in the pop3 store */
+		camel_medium_add_header (CAMEL_MEDIUM (message), "X-Evolution-POP3-UID", uid);
 	}
 done:
 	camel_object_unref (stream);
diff --git a/camel/providers/pop3/camel-pop3-provider.c b/camel/providers/pop3/camel-pop3-provider.c
index 21cb6e8..be429e2 100644
--- a/camel/providers/pop3/camel-pop3-provider.c
+++ b/camel/providers/pop3/camel-pop3-provider.c
@@ -41,6 +41,8 @@ static CamelProviderConfEntry pop3_conf_entries[] = {
 	  N_("_Leave messages on server"), "0" },
 	{ CAMEL_PROVIDER_CONF_CHECKSPIN, "delete_after", "keep_on_server",
 	  N_("_Delete after %s day(s)"), "0:1:7:365" },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "delete_expunged", "keep_on_server",
+	  N_("Delete _expunged from Inbox"), "0" },
 	{ CAMEL_PROVIDER_CONF_CHECKBOX, "disable_extensions", NULL,
 	  N_("Disable _support for all POP3 extensions"), "0" },
 	{ CAMEL_PROVIDER_CONF_SECTION_END },
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 34c10cb..038a861 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -168,7 +168,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 	guint32 flags = 0;
 	gint clean_quit = TRUE;
 	gint ret;
-	const gchar *delete_days;
+	const gchar *param;
 
 	if (ssl_mode != MODE_CLEAR) {
 #ifdef HAVE_SSL
@@ -211,8 +211,13 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 	if (camel_url_get_param (service->url, "disable_extensions"))
 		flags |= CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS;
 
-	if ((delete_days = (gchar *) camel_url_get_param(service->url,"delete_after")))
-		store->delete_after =  atoi(delete_days);
+	store->keep_on_server =  camel_url_get_param (service->url, "keep_on_server") != NULL;
+	store->delete_expunged =  camel_url_get_param (service->url, "delete_expunged") != NULL;
+
+	if ((param = camel_url_get_param (service->url, "delete_after")))
+		store->delete_after =  atoi (param);
+	else
+		store->delete_after = 0;
 
 	if (!(store->engine = camel_pop3_engine_new (tcp_stream, flags))) {
 		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
diff --git a/camel/providers/pop3/camel-pop3-store.h b/camel/providers/pop3/camel-pop3-store.h
index d55fa2e..d185940 100644
--- a/camel/providers/pop3/camel-pop3-store.h
+++ b/camel/providers/pop3/camel-pop3-store.h
@@ -44,7 +44,9 @@ typedef struct {
 
 	struct _CamelDataCache *cache;
 
+	gboolean keep_on_server;
 	guint delete_after;
+	gboolean delete_expunged;
 } CamelPOP3Store;
 
 typedef struct {
