From 2c074a94f39d0f1e3c17499b530134d04a88903b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?=
 <marcosgdf@gmail.com>
Date: Sun, 15 Feb 2015 15:57:38 +0100
Subject: [PATCH] Fix: [ bug #1790 ] Sending a test mail from admin page, gives
 "File already exists" error

---
 ChangeLog                                 | 1 +
 htdocs/core/class/html.formmail.class.php | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 5870e55152d..0b21f163136 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@ English Dolibarr ChangeLog
 - Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase
 - Fix: [ bug #1819 ] SQL error when searching for an invoice payment
 - Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes
+- Fix: [ bug #1790 ] Sending a test mail from admin page, gives "File already exists" error
 
 ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
 - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 9d80ced54e3..45e0aec2f65 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -2,6 +2,7 @@
 /* Copyright (C) 2005-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2012 Regis Houssin		<regis.houssin@capnetworks.com>
  * Copyright (C) 2010-2011 Juanjo Menent		<jmenent@2byte.es>
+ * Copyright (C) 2015      Marcos GarcĂ­a        <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -500,6 +501,10 @@ 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))
         	{
-- 
GitLab