print '      <td>' . trim(preg_replace('/<.*>|"/', '', @iconv_mime_decode(imap_utf8($mail->from)))) . '</td>';
 print '      <td style="text-align:center;width: 115px;">' . date("d/m/Y H:i", strtotime($mail->date)) . '</td>';
 print '      <td style="text-align:right;">' . number_format($mail->size, 2) . $unit . '</td>';
 print '      <td align="center">';
 if ($mail->flagged) {
     print img_picto('flagged', 'flagged@dolimail');
 } else {
     print img_picto('unflagged', 'unflagged@dolimail');
 }
 print '</td>';
 print '<td>';
 print '<form name="link_' . $i . '" method="POST">';
 print '<table><tr><td>';
 $out = '';
 if ($conf->use_javascript_ajax) {
     $out .= ajax_multiautocompleter('reference_' . $i, array('reference_rowid_' . $i, 'reference_type_element_' . $i, 'reference_fk_socid_' . $i), dol_buildpath('/dolimail/core/ajax/reference.php', 1), 'num_ligne=' . $i) . "\n";
 }
 $out .= '<input id="reference_' . $i . '" type="text" name="reference" value="';
 print $out . '">' . "\n";
 print '<input id="reference_rowid_' . $i . '" type="hidden" name="reference_rowid" value="';
 print '">' . "\n";
 print '<input id="reference_type_element_' . $i . '" type="hidden" name="reference_type_element" value="';
 print '">' . "\n";
 print '<input id="reference_fk_socid_' . $i . '" type="hidden" name="reference_fk_socid" value="';
 print '">' . "\n";
 print '<input id="reference_mail_uid_' . $i . '" type="hidden" name="reference_mail_uid" value="';
 print $mail->uid;
 print '">' . "\n";
 print '</td><td>';
 print '<a href="javascript:;" onclick="link_' . $i . '.submit();">';
 print img_picto('attacher', 'lock');
	/**
	 *    Return a select list with zip codes and their town
	 *    @param       selected
	 *    @param       htmlname
	 *    @param       fields
	 *    @param       fieldsize
	 *    @param       disableautocomplete     1 To disable autocomplete features
	 */
	function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0)
	{
		global $conf;

		$out='';

		$size='';
		if (!empty($fieldsize)) $size='size="'.$fieldsize.'"';

		if ($conf->use_javascript_ajax && empty($disableautocomplete))	$out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajaxziptown.php')."\n";
		$out.= '<input id="'.$htmlname.'" type="text" name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n";

		return $out;
	}
 /**
  *    Return a select list with zip codes and their town
  *
  *    @param	string		$selected				Preselected value
  *    @param    string		$htmlname				HTML select name
  *    @param    string		$fields					Fields
  *    @param    int			$fieldsize				Field size
  *    @param    int			$disableautocomplete    1 To disable autocomplete features
  *    @return	void
  */
 function select_ziptown($selected = '', $htmlname = 'zipcode', $fields = '', $fieldsize = 0, $disableautocomplete = 0)
 {
     global $conf;
     include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
     $out = '';
     $size = '';
     if (!empty($fieldsize)) {
         $size = 'size="' . $fieldsize . '"';
     }
     $out .= '<input id="' . $htmlname . '" type="text" name="' . $htmlname . '" ' . $size . ' value="' . $selected . '" class="input-text large" >' . "\n";
     $out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT . '/core/ajax/ziptown.php') . "\n";
     return $out;
 }