diff --git a/doc/man/sieved.1 b/doc/man/sieved.1
index 521b0b5950e6c56aecbc5f14f39a884218217bb4..15d53b90d9ab978a99bce9507efd122118ec9d86 100644
--- a/doc/man/sieved.1
+++ b/doc/man/sieved.1
@@ -2,7 +2,7 @@
 .SH NAME
 sieved \- Sieve script binary dump tool for the Dovecot secure IMAP server
 .SH SYNOPSIS
-sieved \fIsieve-binary\fR [\fIoutfile\fR]
+sieved [\fB-x\fR "\fIextension extension ...\fR"] \fIsieve-binary\fR [\fIoutfile\fR]
 .br
 .SH DESCRIPTION
 .PP
@@ -30,6 +30,11 @@ program. Compiled Sieve programs are represented as flat byte code and therefore
 the main program is a disassembly listing of the interpreter operations. Extensions can define 
 new operations and use additional blocks. Therefore, the output of \fBsieved\fP depends greatly
 on the language extensions used when compiling the binary. 
+.SH OPTIONS
+.TP
+\fB-x\fP "\fIextension extension ...\fP"
+Set the available extensions. The option's parameter is a space-separated list of the active
+extensions. Unknown extensions are ignored, but a warning is produced.
 .SH AUTHOR
 .PP
 The Sieve implementation for Dovecot was written by Stephan Bosch <stephan@rename-it.nl>.
diff --git a/src/sieve-tools/sieved.c b/src/sieve-tools/sieved.c
index 24c4ad2344a02eb98f3a18f3bdf17cab60c1998f..5447e3b14a2060b70f4d0b9d8d1c980e38a1f902 100644
--- a/src/sieve-tools/sieved.c
+++ b/src/sieve-tools/sieved.c
@@ -33,11 +33,19 @@ static void print_help(void)
 int main(int argc, char **argv) {
 	int i;
 	struct sieve_binary *sbin;
-	const char *binfile, *outfile;
-		
-	binfile = outfile = NULL;
+	const char *binfile, *outfile, *extensions;
+	
+	sieve_tool_init();
+	
+	binfile = outfile = extensions = NULL;
 	for (i = 1; i < argc; i++) {
-		if ( binfile == NULL ) {
+		if (strcmp(argv[i], "-x") == 0) {
+			/* extensions */
+			i++;
+			if (i == argc)
+				i_fatal("Missing -x argument");
+			extensions = argv[i];
+		} else if ( binfile == NULL ) {
 			binfile = argv[i];
 		} else if ( outfile == NULL ) {
 			outfile = argv[i];
@@ -51,9 +59,11 @@ int main(int argc, char **argv) {
 		print_help();
 		i_fatal("missing <binfile> argument");
 	}
-	
-	sieve_tool_init();
-	
+
+	if ( extensions != NULL ) {
+		sieve_set_extensions(extensions);
+	}
+		
 	sbin = sieve_binary_open(binfile, NULL);
 
 	if ( sbin != NULL && !sieve_binary_load(sbin) ) {