diff --git a/configure b/configure
index 459bdf3..6742d76 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 301221 .
+# From configure.ac Revision.
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.67 for asterisk trunk.
 #
@@ -26867,8 +26867,8 @@ fi
     if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then
 	PBX_GMIME=0
 	if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gmime-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gmime-config; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}gmime-configbla", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gmime-configbla; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_CONFIG_GMIME+set}" = set; then :
@@ -26911,8 +26911,8 @@ fi
 fi
 if test -z "$ac_cv_path_CONFIG_GMIME"; then
   ac_pt_CONFIG_GMIME=$CONFIG_GMIME
-  # Extract the first word of "gmime-config", so it can be a program name with args.
-set dummy gmime-config; ac_word=$2
+  # Extract the first word of "gmime-configbla", so it can be a program name with args.
+set dummy gmime-configbla; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_ac_pt_CONFIG_GMIME+set}" = set; then :
@@ -27015,20 +27015,19 @@ $as_echo "#define HAVE_GMIME 1" >>confdefs.h
 
 if test "x${PBX_GMIME}" = "x0"; then
 	# Later versions of GMime use pkg-config
-	if test "x${PKGCONFIG}" = xNo; then :; else
-		GMIME_INCLUDE=$(${PKGCONFIG} gmime-2.0 --cflags 2>/dev/null)
-		GMIME_LIB=$(${PKGCONFIG} gmime-2.0 --libs)
-		if test "x${GMIME_INCLUDE}${GMIME_LIB}" = "x"; then
-			GMIME_INCLUDE=$(${PKGCONFIG} gmime-2.2 --cflags 2>/dev/null)
-			GMIME_LIB=$(${PKGCONFIG} gmime-2.2 --libs)
+	for ver in 2.0 2.2 2.4; do
+		if ! ${PKGCONFIG} gmime-$ver; then
+			continue
 		fi
-		if test "x${GMIME_INCLUDE}${GMIME_LIB}" != "x"; then
-			PBX_GMIME=1
+		# If we got here, we have this version:
+		GMIME_INCLUDE=$(${PKGCONFIG} gmime-$ver --cflags 2>/dev/null)
+		GMIME_LIB=$(${PKGCONFIG} gmime-$ver --libs)
+		PBX_GMIME=1
 
 $as_echo "#define HAVE_GMIME 1" >>confdefs.h
 
-		fi
-	fi
+		break;
+	done
 fi
 
 
diff --git a/configure.ac b/configure.ac
index 889586a..892d158 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1995,18 +1995,17 @@ fi
 AST_EXT_TOOL_CHECK([GMIME], [gmime-config], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);])
 if test "x${PBX_GMIME}" = "x0"; then
 	# Later versions of GMime use pkg-config
-	if test "x${PKGCONFIG}" = xNo; then :; else
-		GMIME_INCLUDE=$(${PKGCONFIG} gmime-2.0 --cflags 2>/dev/null)
-		GMIME_LIB=$(${PKGCONFIG} gmime-2.0 --libs)
-		if test "x${GMIME_INCLUDE}${GMIME_LIB}" = "x"; then 
-			GMIME_INCLUDE=$(${PKGCONFIG} gmime-2.2 --cflags 2>/dev/null)
-			GMIME_LIB=$(${PKGCONFIG} gmime-2.2 --libs)
+	for ver in 2.0 2.2 2.4; do
+		if ! ${PKGCONFIG} --exists gmime-$ver; then
+			continue
 		fi
-		if test "x${GMIME_INCLUDE}${GMIME_LIB}" != "x"; then
-			PBX_GMIME=1
-			AC_DEFINE([HAVE_GMIME], 1, [Define if your system has the GMIME libraries.])
-		fi
-	fi
+		# If we got here, we have this version:
+		GMIME_INCLUDE=$(${PKGCONFIG} gmime-$ver --cflags 2>/dev/null)
+		GMIME_LIB=$(${PKGCONFIG} gmime-$ver --libs)
+		PBX_GMIME=1
+		AC_DEFINE([HAVE_GMIME], 1, [Define if your system has the GMIME libraries.])
+		break;
+	done
 fi
 
 AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
diff --git a/res/res_http_post.c b/res/res_http_post.c
index 5fff5d8..82c606e 100644
--- a/res/res_http_post.c
+++ b/res/res_http_post.c
@@ -108,7 +108,7 @@ static GMimeMessage *parse_message(FILE *f)
 	return message;
 }
 
-static void process_message_callback(GMimeObject *part, gpointer user_data)
+static void process_message_callback(GMimeObject *parent, GMimeObject *part, gpointer user_data)
 {
 	struct mime_cbinfo *cbinfo = user_data;
 
@@ -122,13 +122,13 @@ static void process_message_callback(GMimeObject *part, gpointer user_data)
 		ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MESSAGE_PARTIAL\n");
 		return;
 	} else if (GMIME_IS_MULTIPART(part)) {
-		GList *l;
+		int i;
+		GMimeMultipart *mp = GMIME_MULTIPART(part);
 		
 		ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MULTIPART, trying to process subparts\n");
-		l = GMIME_MULTIPART(part)->subparts;
-		while (l) {
-			process_message_callback(l->data, cbinfo);
-			l = l->next;
+		for (i = 0; i < g_mime_multipart_get_count(mp); i++) {
+			GMimeObject *subpart = g_mime_multipart_get_part(mp, i);
+			process_message_callback(part, subpart, cbinfo);
 		}
 	} else if (GMIME_IS_PART(part)) {
 		const char *filename;
@@ -151,7 +151,7 @@ static int process_message(GMimeMessage *message, const char *post_dir)
 		.post_dir = post_dir,
 	};
 
-	g_mime_message_foreach_part(message, process_message_callback, &cbinfo);
+	g_mime_message_foreach(message, process_message_callback, &cbinfo);
 
 	return cbinfo.count;
 }
