<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>https://support.qbpro.ru/index.php?action=history&amp;feed=atom&amp;title=%D0%9B%D0%B5%D1%87%D0%B8%D0%BC_%D0%BF%D0%BE%D1%87%D1%82%D0%BE%D0%B2%D1%8B%D0%B5_%D0%B2%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F_winmail.dat</id>
	<title>Лечим почтовые вложения winmail.dat - История изменений</title>
	<link rel="self" type="application/atom+xml" href="https://support.qbpro.ru/index.php?action=history&amp;feed=atom&amp;title=%D0%9B%D0%B5%D1%87%D0%B8%D0%BC_%D0%BF%D0%BE%D1%87%D1%82%D0%BE%D0%B2%D1%8B%D0%B5_%D0%B2%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F_winmail.dat"/>
	<link rel="alternate" type="text/html" href="https://support.qbpro.ru/index.php?title=%D0%9B%D0%B5%D1%87%D0%B8%D0%BC_%D0%BF%D0%BE%D1%87%D1%82%D0%BE%D0%B2%D1%8B%D0%B5_%D0%B2%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F_winmail.dat&amp;action=history"/>
	<updated>2026-05-14T14:23:21Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.38.1</generator>
	<entry>
		<id>https://support.qbpro.ru/index.php?title=%D0%9B%D0%B5%D1%87%D0%B8%D0%BC_%D0%BF%D0%BE%D1%87%D1%82%D0%BE%D0%B2%D1%8B%D0%B5_%D0%B2%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F_winmail.dat&amp;diff=3752&amp;oldid=prev</id>
		<title>Vix: Новая страница: «Проблема древняя и как водится связана с попыткой Microsoft навязывать свои стандарты. Откуда берется почтовое вложение winmail.dat вы можете почитать тут: https://support.mozilla.org/ru/kb/chto-oznachaet-vlozhenie-winmaildat  сегодня мы решим эту проблему глобально, прокачаем наш postfix сервер...»</title>
		<link rel="alternate" type="text/html" href="https://support.qbpro.ru/index.php?title=%D0%9B%D0%B5%D1%87%D0%B8%D0%BC_%D0%BF%D0%BE%D1%87%D1%82%D0%BE%D0%B2%D1%8B%D0%B5_%D0%B2%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F_winmail.dat&amp;diff=3752&amp;oldid=prev"/>
		<updated>2023-06-23T07:41:34Z</updated>

		<summary type="html">&lt;p&gt;Новая страница: «Проблема древняя и как водится связана с попыткой Microsoft навязывать свои стандарты. Откуда берется почтовое вложение winmail.dat вы можете почитать тут: https://support.mozilla.org/ru/kb/chto-oznachaet-vlozhenie-winmaildat  сегодня мы решим эту проблему глобально, прокачаем наш postfix сервер...»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Проблема древняя и как водится связана с попыткой Microsoft навязывать свои стандарты. Откуда берется почтовое вложение winmail.dat вы можете почитать тут: https://support.mozilla.org/ru/kb/chto-oznachaet-vlozhenie-winmaildat&lt;br /&gt;
&lt;br /&gt;
сегодня мы решим эту проблему глобально, прокачаем наш postfix сервер&lt;br /&gt;
&lt;br /&gt;
Установим MIMEDefang.&lt;br /&gt;
для CentOS&lt;br /&gt;
&lt;br /&gt;
 yum install mimedefang&lt;br /&gt;
для Ubuntu&lt;br /&gt;
&lt;br /&gt;
 apt-get install mimedefang&lt;br /&gt;
Настроим MIMEDefang на определенный порт TCP, наша служба будет слушать этот порт. Для этого исправим конфигурацию&lt;br /&gt;
 для CentOS: /etc/sysconfig/mimedefang&lt;br /&gt;
 для Ubuntu: /etc/default/mimedefang&lt;br /&gt;
&lt;br /&gt;
дописываем в конце&lt;br /&gt;
&lt;br /&gt;
 SOCKET=inet:10185&lt;br /&gt;
Отредактируем файл /etc/mail/mimedefang-filter, можете просто вставить текст ниже&lt;br /&gt;
 # -*- Perl -*-&lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 #&lt;br /&gt;
 # mimedefang-filter&lt;br /&gt;
 #&lt;br /&gt;
 # Suggested minimum-protection filter for Microsoft Windows clients, plus&lt;br /&gt;
 # SpamAssassin checks if SpamAssassin is installed.&lt;br /&gt;
 #&lt;br /&gt;
 # Copyright (C) 2002 Roaring Penguin Software Inc.&lt;br /&gt;
 #&lt;br /&gt;
 # This program may be distributed under the terms of the GNU General&lt;br /&gt;
 # Public License, Version 2, or (at your option) any later version.&lt;br /&gt;
 #&lt;br /&gt;
 # $Id$&lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 &lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 # Set administrator's e-mail address here.  The administrator receives&lt;br /&gt;
 # quarantine messages and is listed as the contact for site-wide&lt;br /&gt;
 # MIMEDefang policy.  A good example would be 'defang-admin@mydomain.com'&lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 $AdminAddress = 'postmaster@localhost';&lt;br /&gt;
 $AdminName = &amp;quot;MIMEDefang Administrator's Full Name&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 # Set the e-mail address from which MIMEDefang quarantine warnings and&lt;br /&gt;
 # user notifications appear to come.  A good example would be&lt;br /&gt;
 # 'mimedefang@mydomain.com'.  Make sure to have an alias for this&lt;br /&gt;
 # address if you want replies to it to work.&lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 $DaemonAddress = 'mimedefang@localhost'; &lt;br /&gt;
 &lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 # If you set $AddWarningsInline to 1, then MIMEDefang tries *very* hard&lt;br /&gt;
 # to add warnings directly in the message body (text or html) rather&lt;br /&gt;
 # than adding a separate &amp;quot;WARNING.TXT&amp;quot; MIME part.  If the message&lt;br /&gt;
 # has no text or html part, then a separate MIME part is still used.&lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 $AddWarningsInline = 0; &lt;br /&gt;
 &lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 # To enable syslogging of virus and spam activity, add the following&lt;br /&gt;
 # to the filter:&lt;br /&gt;
 # md_graphdefang_log_enable();&lt;br /&gt;
 # You may optionally provide a syslogging facility by passing an&lt;br /&gt;
 # argument such as:  md_graphdefang_log_enable('local4');  If you do this, be&lt;br /&gt;
 # sure to setup the new syslog facility (probably in /etc/syslog.conf).&lt;br /&gt;
 # An optional second argument causes a line of output to be produced&lt;br /&gt;
 # for each recipient (if it is 1), or only a single summary line&lt;br /&gt;
 # for all recipients (if it is 0.)  The default is 1.&lt;br /&gt;
 # Comment this line out to disable logging.&lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 md_graphdefang_log_enable('mail', 1); &lt;br /&gt;
 &lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 # Uncomment this to block messages with more than 50 parts.  This will&lt;br /&gt;
 # *NOT* work unless you're using Roaring Penguin's patched version&lt;br /&gt;
 # of MIME tools, version MIME-tools-5.411a-RP-Patched-02 or later.&lt;br /&gt;
 #&lt;br /&gt;
 # WARNING: DO NOT SET THIS VARIABLE unless you're using at least&lt;br /&gt;
 # MIME-tools-5.411a-RP-Patched-02; otherwise, your filter will fail.&lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 # $MaxMIMEParts = 50;&lt;br /&gt;
 &lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 # Set various stupid things your mail client does below.&lt;br /&gt;
 #***********************************************************************&lt;br /&gt;
 &lt;br /&gt;
 # Set the next one if your mail client cannot handle multiple &amp;quot;inline&amp;quot;&lt;br /&gt;
 # parts .&lt;br /&gt;
 $Stupidity{&amp;quot;NoMultipleInlines&amp;quot;} = 0; &lt;br /&gt;
&lt;br /&gt;
 # Detect and load Perl modules&lt;br /&gt;
 detect_and_load_perl_modules();&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 sub filter {&lt;br /&gt;
     my($entity, $fname, $ext, $type) = @_;&lt;br /&gt;
  &lt;br /&gt;
     ### Convert TNEF winmail.dat format&lt;br /&gt;
     ### Note: You must install Convert::TNEF and File::Type from CPAN before using this script&lt;br /&gt;
     if (lc($type) eq &amp;quot;application/ms-tnef&amp;quot; or lc($fname) eq &amp;quot;winmail.dat&amp;quot; ) {&lt;br /&gt;
         use Convert::TNEF;&lt;br /&gt;
         use File::Type;&lt;br /&gt;
         use File::Temp qw(tempfile tempdir);&lt;br /&gt;
  &lt;br /&gt;
         # Create a unique temporary directory under &amp;quot;/tmp&amp;quot;&lt;br /&gt;
         my $tnefdir = tempdir(CLEANUP =&amp;gt; 1, DIR =&amp;gt; &amp;quot;/tmp&amp;quot;);&lt;br /&gt;
         if (not $tnefdir) {&lt;br /&gt;
                 md_graphdefang_log('tnef_fail',&amp;quot;Unable to create temporary directory&amp;quot;);&lt;br /&gt;
                 return action_accept();&lt;br /&gt;
         }&lt;br /&gt;
  &lt;br /&gt;
         # If we can't Convert the TNEF file for some reason, just accept the attachment and log the &lt;br /&gt;
 error&lt;br /&gt;
         my $tnef = Convert::TNEF-&amp;gt;read_ent($entity,{output_dir=&amp;gt;&amp;quot;$tnefdir&amp;quot;});&lt;br /&gt;
         if (not $tnef) {&lt;br /&gt;
                 md_graphdefang_log('tnef_fail',$Convert::TNEF::errstr);&lt;br /&gt;
                 return action_accept();&lt;br /&gt;
         }&lt;br /&gt;
  &lt;br /&gt;
         my $ft = File::Type-&amp;gt;new();&lt;br /&gt;
  &lt;br /&gt;
         # Append attachments contained in the winmail.dat file to the message.&lt;br /&gt;
         for ($tnef-&amp;gt;attachments) {&lt;br /&gt;
              # Determine the mime-type of the file&lt;br /&gt;
              my $mimetype = $ft-&amp;gt;mime_type($_-&amp;gt;data);&lt;br /&gt;
  &lt;br /&gt;
                 # File::Type doesn't detect text files well, this is a workaround&lt;br /&gt;
              if ($mimetype eq &amp;quot;application/octet-stream&amp;quot;) {&lt;br /&gt;
                   #Set the mime-type to text/plain if the first 1024 characters are printable&lt;br /&gt;
                   $text_check = substr($_-&amp;gt;data,0,1024);&lt;br /&gt;
                   $mimetype = &amp;quot;text/plain&amp;quot; unless $text_check =~ /[^[:print:]s]/;&lt;br /&gt;
              }&lt;br /&gt;
  &lt;br /&gt;
             my $tnef_entity = action_add_part($entity, &amp;quot;$mimetype&amp;quot;, &amp;quot;base64&amp;quot;, $_-&amp;gt;data, $_- &amp;gt;longname, &amp;quot;attachment&amp;quot;);&lt;br /&gt;
              md_graphdefang_log('tnef_ext', &amp;quot;File: &amp;quot; . $_-&amp;gt;longname . &amp;quot; Type: $mimetype&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
              # Run each new TNEF-sourced MIME part back through the filter again, this ensures that &lt;br /&gt;
 bad filenames etc.&lt;br /&gt;
              # cannot sneak through by being contained in winmail.dat files&lt;br /&gt;
  &lt;br /&gt;
              filter ($tnef_entity, $_-&amp;gt;longname, &amp;quot;&amp;quot;, &amp;quot;$mimetype&amp;quot;);&lt;br /&gt;
         }&lt;br /&gt;
  &lt;br /&gt;
         # Deletes working files&lt;br /&gt;
         $tnef-&amp;gt;purge;&lt;br /&gt;
 &lt;br /&gt;
  &lt;br /&gt;
         # Remark this if you want still want to keep the original winmail.dat file&lt;br /&gt;
          return action_drop();&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     # Keep the attachment&lt;br /&gt;
     return action_accept();&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # DO NOT delete the next line, or Perl will complain.&lt;br /&gt;
 1;&lt;br /&gt;
Раскрыть&lt;br /&gt;
Установим модели Perl Convert::TNEF и File::Type&lt;br /&gt;
для CentOS&lt;br /&gt;
&lt;br /&gt;
 yum install perl-Convert-TNEF.noarch&lt;br /&gt;
второй пакет надо скачать и установить&lt;br /&gt;
&lt;br /&gt;
 wget https://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/x86_64/rpmforge/RPMS/perl-File-Type-0.22-1.el6.rf.noarch.rpm&lt;br /&gt;
 yum install perl-File-Type-0.22-1.el6.rf.noarch.rpm&lt;br /&gt;
для Ubuntu&lt;br /&gt;
&lt;br /&gt;
 apt-get install libconvert-tnef-perl&lt;br /&gt;
 apt-get install libfile-type-perl&lt;br /&gt;
Проверим синтаксис Perl&lt;br /&gt;
 # perl -c /etc/mail/mimedefang-filter&lt;br /&gt;
Настроим автозапуск службы MIMEDefang и запустим ее&lt;br /&gt;
 systemctl enable mimedefang.service&lt;br /&gt;
 service mimedefang restart&lt;br /&gt;
Проверим, слушает ли сервис указанный выше порт&lt;br /&gt;
 # netstat -tlpn | grep 10185&lt;br /&gt;
 tcp        0      0 0.0.0.0:10185           0.0.0.0:*               LISTEN      7401/mimedefang&lt;br /&gt;
Теперь добавим проверку в Postfix, для этого откроем конфиг /etc/postfic/main.cf&lt;br /&gt;
и допишем в конце&lt;br /&gt;
&lt;br /&gt;
 smtpd_milters = inet:localhost:10185&lt;br /&gt;
 milter_default_action = accept&lt;br /&gt;
готово! Любое письмо, которое будет иметь во вложении winmail.dat, будет обработано нашей службой и вложение будет расшифровано!&lt;br /&gt;
&lt;br /&gt;
* [https://itscience.pro/all/lechim-pochtovye-vlozheniya-winmail-dat/ IT science]&lt;/div&gt;</summary>
		<author><name>Vix</name></author>
	</entry>
</feed>