diff --git a/src/lib-sieve/plugins/enotify/ext-enotify-common.c b/src/lib-sieve/plugins/enotify/ext-enotify-common.c
index 0cb67ee64c02b1405d9617e4f6239d9ecc9ac7ac..292ed21eb847271e084f89c39cfa766711242783 100644
--- a/src/lib-sieve/plugins/enotify/ext-enotify-common.c
+++ b/src/lib-sieve/plugins/enotify/ext-enotify-common.c
@@ -94,21 +94,27 @@ ext_enotify_method_register(struct ext_enotify_context *extctx,
 	nmth->svinst = ntfy_ext->svinst;
 	nmth->ext = ntfy_ext;
 
-	if (nmth_def->load != NULL)
-		nmth_def->load(nmth, &nmth->context);
+	if (nmth_def->load != NULL &&
+	    nmth_def->load(nmth, &nmth->context) < 0) {
+		array_pop_back(&extctx->notify_methods);
+		return -1;
+	}
 
 	*nmth_r = nmth;
 	return 0;
 }
 
-void ext_enotify_methods_init(struct ext_enotify_context *extctx,
-			      const struct sieve_extension *ntfy_ext)
+int ext_enotify_methods_init(struct ext_enotify_context *extctx,
+			     const struct sieve_extension *ntfy_ext)
 {
 	const struct sieve_enotify_method *nmth;
 
 	p_array_init(&extctx->notify_methods, default_pool, 4);
 
-	ext_enotify_method_register(extctx, ntfy_ext, &mailto_notify, &nmth);
+	if (ext_enotify_method_register(extctx, ntfy_ext,
+					&mailto_notify, &nmth) < 0)
+		return -1;
+	return 0;
 }
 
 void ext_enotify_methods_deinit(struct ext_enotify_context *extctx)
diff --git a/src/lib-sieve/plugins/enotify/ext-enotify-common.h b/src/lib-sieve/plugins/enotify/ext-enotify-common.h
index 4235242644316c37671a6e72a361d917072e6306..7029dfe4521ffe5389e81d5d1f4ac3f47e19aba5 100644
--- a/src/lib-sieve/plugins/enotify/ext-enotify-common.h
+++ b/src/lib-sieve/plugins/enotify/ext-enotify-common.h
@@ -76,8 +76,8 @@ extern const struct sieve_variables_modifier_def encodeurl_modifier;
  * Notify methods
  */
 
-void ext_enotify_methods_init(struct ext_enotify_context *extctx,
-			      const struct sieve_extension *ntfy_ext);
+int ext_enotify_methods_init(struct ext_enotify_context *extctx,
+			     const struct sieve_extension *ntfy_ext);
 void ext_enotify_methods_deinit(struct ext_enotify_context *extctx);
 
 const struct sieve_enotify_method *
diff --git a/src/lib-sieve/plugins/enotify/ext-enotify.c b/src/lib-sieve/plugins/enotify/ext-enotify.c
index 4711cb7e7233cae97b1decc5e9ca55ad04c11e8a..543d65e2df7fa03a02ceae2f8fbd9170ef6f405a 100644
--- a/src/lib-sieve/plugins/enotify/ext-enotify.c
+++ b/src/lib-sieve/plugins/enotify/ext-enotify.c
@@ -67,7 +67,10 @@ static int ext_enotify_load(const struct sieve_extension *ext, void **context_r)
 	extctx = i_new(struct ext_enotify_context, 1);
 	extctx->var_ext = var_ext;
 
-	ext_enotify_methods_init(extctx, ext);
+	if (ext_enotify_methods_init(extctx, ext) < 0) {
+		i_free(extctx);
+		return -1;
+	}
 
 	sieve_extension_capabilities_register(ext, &notify_capabilities);
 
@@ -79,8 +82,10 @@ static void ext_enotify_unload(const struct sieve_extension *ext)
 {
 	struct ext_enotify_context *extctx = ext->context;
 
-	ext_enotify_methods_deinit(extctx);
+	if (extctx == NULL)
+		return;
 
+	ext_enotify_methods_deinit(extctx);
 	i_free(extctx);
 }
 
diff --git a/src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c b/src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c
index a8469eb10cc29544d42231b38c7b02842eafc89f..09440fe4561b134dd1aca1fc64c6538806b4caee 100644
--- a/src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c
+++ b/src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c
@@ -52,7 +52,7 @@
  * Mailto notification method
  */
 
-static bool
+static int
 ntfy_mailto_load(const struct sieve_enotify_method *nmth, void **context);
 static void
 ntfy_mailto_unload(const struct sieve_enotify_method *nmth);
@@ -155,16 +155,13 @@ struct ntfy_mailto_context {
 	struct sieve_address_source envelope_from;
 };
 
-static bool
-ntfy_mailto_load(const struct sieve_enotify_method *nmth, void **context)
+static int
+ntfy_mailto_load(const struct sieve_enotify_method *nmth, void **context_r)
 {
 	struct sieve_instance *svinst = nmth->svinst;
 	struct ntfy_mailto_context *mtctx;
 	pool_t pool;
 
-	if (*context != NULL)
-		ntfy_mailto_unload(nmth);
-
 	pool = pool_alloconly_create("ntfy_mailto_context", 256);
 	mtctx = p_new(pool, struct ntfy_mailto_context, 1);
 	mtctx->pool = pool;
@@ -173,8 +170,8 @@ ntfy_mailto_load(const struct sieve_enotify_method *nmth, void **context)
 		svinst, mtctx->pool, "sieve_notify_mailto_envelope_from",
 		&mtctx->envelope_from);
 
-	*context = mtctx;
-	return TRUE;
+	*context_r = mtctx;
+	return 0;
 }
 
 static void ntfy_mailto_unload(const struct sieve_enotify_method *nmth)
diff --git a/src/lib-sieve/plugins/enotify/sieve-ext-enotify.h b/src/lib-sieve/plugins/enotify/sieve-ext-enotify.h
index e65b29e9973c4e6c074bae3ac312f797245672b3..849a3315f51df4ab88022091b058146bb128efdd 100644
--- a/src/lib-sieve/plugins/enotify/sieve-ext-enotify.h
+++ b/src/lib-sieve/plugins/enotify/sieve-ext-enotify.h
@@ -35,7 +35,7 @@ struct sieve_enotify_method_def {
 	const char *identifier;
 
 	/* Registration */
-	bool (*load)(const struct sieve_enotify_method *nmth, void **context);
+	int (*load)(const struct sieve_enotify_method *nmth, void **context);
 	void (*unload)(const struct sieve_enotify_method *nmth);
 
 	/* Validation */