diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 90f14fa27ff..bbef7fbd882 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -326,11 +326,37 @@ class FormMail
if ($this->withto || is_array($this->withto))
{
$out.= '
| ';
- $out.= $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
+ if ($this->withtofree) $out.= $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
+ else $out.= $langs->trans("MailTo");
$out.= ' | ';
if ($this->withtoreadonly)
{
- $out.= (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
+ if (! empty($this->toname) && ! empty($this->tomail))
+ {
+ $out.= '';
+ $out.= '';
+ if ($this->totype == 'thirdparty')
+ {
+ $soc=new Societe($this->db);
+ $soc->fetch($this->toid);
+ $out.= $soc->getNomUrl(1);
+ }
+ if ($this->totype == 'contact')
+ {
+ $contact=new Contact($this->db);
+ $contact->fetch($this->toid);
+ $out.= $contact->getNomUrl(1);
+ }
+ else
+ {
+ $out.= $this->toname;
+ }
+ $out.= ' <'.$this->tomail.'>';
+ }
+ else
+ {
+ $out.= (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
+ }
}
else
{
|