diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 45e0aec2f659738844b3e35f8dc733e75201b95d..7ffd535f0ece4c6061559d7bd4daa08ffa2f0969 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -255,6 +255,7 @@ class FormMail
         	if ($this->withform == 1)
         	{
         		$out.= '<form method="POST" name="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">'."\n";
+				$out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">';
         		$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
         	}
         	foreach ($this->param as $key=>$value)
@@ -501,10 +502,6 @@ class FormMail
         		$out.= "</td></tr>\n";
         	}
 
-	        if ($this->withform == 1 || $this->withform == -1) {
-		        $out .= '<input style="display:none" type="submit" id="sendmail" name="sendmail">';
-	        }
-
         	// Attached files
         	if (! empty($this->withfile))
         	{