diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 710091a1661..312d6c3d507 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -93,7 +93,7 @@ if (! $error && $massaction == 'confirm_presend')
}
// Check mandatory parameters
- if (empty($user->email))
+ if (GETPOST('fromtype','alpha') === 'user' && empty($user->email))
{
$error++;
setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings');
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 434f49bb3d6..99f14e973ca 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -846,14 +846,17 @@ class FormMail extends Form
$out.= '
';
- if (GETPOSTISSET('sendmail'))
+ if ($this->withmaindocfile) // withmaindocfile is set to 1 or -1 to show the checkbox (-1 = checked or 1 = not checked)
{
- $this->withmaindocfile = (GETPOST('addmaindocfile', 'alpha') ? -1 : 1);
- }
- // If a template was selected, we use setup of template to define if join file checkbox is selected or not.
- elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
- {
- $this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1);
+ if (GETPOSTISSET('sendmail'))
+ {
+ $this->withmaindocfile = (GETPOST('addmaindocfile', 'alpha') ? -1 : 1);
+ }
+ // If a template was selected, we use setup of template to define if join file checkbox is selected or not.
+ elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
+ {
+ $this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1);
+ }
}
if (! empty($this->withmaindocfile))
|