$attachmentsKeys = array_keys($message->Attachments->Instance()); foreach ($attachmentsKeys as $key) { $attachment =& $message->Attachments->Get($key); $tempName = $key . '_' . ConvertUtils::ClearFileName($attachment->GetTempName()); $fileName = ConvertUtils::ClearFileName(ConvertUtils::ClearUtf8($attachment->GetFilenameFromMime(), $GLOBALS[MailInputCharset], $account->GetUserCharset())); $view = $download = null; $size = $tempFiles->SaveFile($tempName, $attachment->GetBinaryBody()); if ($size > -1) { $download = 'attach.php?tn=' . urlencode($tempName) . '&filename=' . urlencode($fileName); $lowerAttachFileName = strtolower($fileName); $contentType = ConvertUtils::GetContentTypeFromFileName($fileName); if (substr($lowerAttachFileName, -4) == '.eml') { $view = 'message-view.php?type=' . MESSAGE_VIEW_TYPE_ATTACH . '&tn=' . urlencode($tempName); } else { if (false !== strpos($contentType, 'image')) { $view = 'message-view.php?type=' . MESSAGE_VIEW_TYPE_ATTACH . '&tn=' . urlencode($tempName); } } } $attachString .= ' <a href="' . ConvertUtils::AttributeQuote($download) . '">' . $fileName . '</a>'; $attachString .= null !== $view ? ' (<a href="' . ConvertUtils::AttributeQuote($view) . '">' . JS_LANG_View . '</a>)' : ''; $attachString .= ','; unset($attachment); } } $attachString = trim($attachString, ', '); $textCharset = $message->GetTextCharset(); $fullBodyText = $message->HasHtmlText() ? ConvertUtils::ReplaceJSMethod(PrintHtmlBodyForViewMsgScreen($message, $account, true)) : nl2br($message->GetCensoredTextBody(true)); break; } PrintMessagePreview($account->DefaultSkin, $_rtl, $fullBodyText, $textCharset, $fromString, $toString, $dateString, $subjectString, $attachString, $ccString, $viewType == MESSAGE_VIEW_TYPE_PRINT);