diff --git a/interface/web/js/mail_domain_dkim.js b/interface/web/js/mail_domain_dkim.js
index 635bca072b9526a2e962396b91c231b84161e9af..fdc7ae5715a8e0195b83e066b07fd483aeaae0c6 100755
--- a/interface/web/js/mail_domain_dkim.js
+++ b/interface/web/js/mail_domain_dkim.js
@@ -66,7 +66,7 @@ function setRequest(action) {
 		}
 		var selector=jQuery('#dkim_selector').val();
 		var publickey=jQuery('#dkim_public').val();
-		var privatekey=jQuery('#dkim_private').val();
+		var privatekey=encodeURIComponent(document.getElementById("dkim_private").value)
 		request.open('POST', 'mail/mail_domain_dkim_create.php', true);
 		request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 		request.send('domain='+domain+'&action='+action+'&dkim_selector='+selector+'&dkim_public='+publickey+'&dkim_private='+privatekey);
diff --git a/interface/web/mail/templates/mail_domain_edit.htm b/interface/web/mail/templates/mail_domain_edit.htm
index 8c1f84868217b35ca741320a15f2d3f9f420c4ab..dbd5c6ef1e6d37957637f69c4800e13f9fc12d91 100755
--- a/interface/web/mail/templates/mail_domain_edit.htm
+++ b/interface/web/mail/templates/mail_domain_edit.htm
@@ -82,12 +82,12 @@
                     {tmpl_var name='active'}
                 </div>
             </div>
-            <div class="subsectiontoggle"><span></span>{tmpl_var name='dkim_settings_txt'}<em></em></div>
 			<tmpl_if name="domain_module">
 				<input type="hidden" name="domain_module" value="1" id="domain_module" />
 			<tmpl_else>
 				<input type="hidden" name="domain_module" value="0" id="domain_module" />
 			</tmpl_if>
+            <div class="subsectiontoggle"><span></span>{tmpl_var name='dkim_settings_txt'}<em></em></div>
             <div style="display:none;">
               <div class="ctrlHolder">
                 <p class="label">{tmpl_var name='dkim_txt'}</p>