如何使用PHP脚本提取TNEF winmail.dat? [英] How to extract TNEF winmail.dat using a PHP script?

查看:110
本文介绍了如何使用PHP脚本提取TNEF winmail.dat?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一种功能,该功能将从邮箱中读取所有电子邮件并处理附件文件.

I am developing a functionality that will read all emails from a mailbox and will process the attachment files.

从Outlook发送任何邮件时,其附件均保存为winmail.dat. [请注意,我已经有使用IMAP PHP下载附件的代码.我的电子邮件附件存储在服务器上我的代码库的一个文件夹中.]我需要将winmail.dat附件解压缩为其原始格式.到目前为止,我遇到的解决方案都需要手动操作,例如提供提取文件的在线工具,或使我们能够转换.DAT文件的软件.

When any mail is sent from Outlook, its attachment is saved as winmail.dat. [Please note that I already have code to download attachments using IMAP PHP. My email attachments are stored in one folder in my codebase on the server.] I need to extract the winmail.dat attachment into its original format. The solutions I came across till now all need manual efforts like an online tool which gives extracted files, or software that enables us to convert .DAT files.

但是我需要使用脚本或诸如cron之类的任何自动化过程来进行提取. [我正在使用Linux-centos 5.7服务器.]

But I need to extract using a script or any automated process like cron or something. [I am using Linux - centos 5.7 server.]

我的应用程序是否有任何库或任何其他方式可以解压缩"这些文件,因此无需手动逐个进行操作即可获得附件?

Is there any library or any other way for my application to "unpack" theses files so I can get the attachments WITHOUT doing it MANUALLY one by one?

谢谢!

推荐答案

从以下位置下载rpm包 http://pkgs .org/centos-5-rhel-5/flexbox-x86_64/tnef-1.4.7-1.x86_64.rpm.html

Download rpm package from http://pkgs.org/centos-5-rhel-5/flexbox-x86_64/tnef-1.4.7-1.x86_64.rpm.html

使用软件包:tnef-1.4.7-1.x86_64.rpm

use Package: tnef-1.4.7-1.x86_64.rpm

安装:

复制到文件夹并安装rpm tnef软件包-

Copy into a folder and Install rpm tnef package -

rpm -ivh /path-of-downloaded-package/tnef-1.4.7-1.x86_64.rpm

要提取附件[winmail.dat]:

To Extract attachment [winmail.dat] :

转到要提取附件文件的目录.

Go in directory where you want to extract your attachment files.

cd /path-to-extract-attachment/

运行命令:

tnef /path-of-attachment/winmail.dat

等效的PHP脚本:

chdir('/path-to-extract-attachment/');

$cmd = "tnef /path-of-attachment/winmail.dat";
shell_exec($cmd);

这篇关于如何使用PHP脚本提取TNEF winmail.dat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆