是否有可以解析msg或eml文件的库?我编写了一个脚本,一旦将电子邮件转换为txt文件就解析它,但我找不到一个电子邮件客户端,允许我轻松地将gui中的电子邮件拖放到文件夹中作为txt文件(如果有人知道这个我很想知道!)
从Outlook中拖放会创建一个.msg文件,Thunderbird会创建一个.eml文件。有谁知道会解析这些文件的库吗?
答案 0 :(得分:8)
对于* .eml文件,您可以使用标准库中的email module。您需要使用email.parser中的Parser来创建消息对象。
答案 1 :(得分:2)
$array2['id'] = $array1['id'];
$array2['updated'] = ['time' => $array1['utime'],
'username' => 'admin@'.$array1['uip']];
$array2['created'] = ['time' => $array1['ctime'],
'username' => 'admin@'.$array1['cip']];
$array2['interface'] = $array1['interface'];
$array2['type'] = $array1['type'];
$array2['disabled'] = $array1['disabled'];
答案 2 :(得分:0)
是的,在我的工作中,我为Independent soft company测试了MSG PY模块。 这是用于Python的Microsoft Outlook .msg文件模块:
from independentsoft.msg import Message
appointment = Message("e:\\appointment.msg")
print("subject: " + str(appointment.subject))
print("start_time: " + str(appointment.appointment_start_time))
print("end_time: " + str(appointment.appointment_end_time))
print("location: " + str(appointment.location))
print("is_reminder_set: " + str(appointment.is_reminder_set))
print("sender_name: " + str(appointment.sender_name))
print("sender_email_address: " + str(appointment.sender_email_address))
print("display_to: " + str(appointment.display_to))
print("display_cc: " + str(appointment.display_cc))
print("body: " + str(appointment.body))