gpt4 book ai didi

linux - 将简单的 emaildump 转换为 maildir 或 mbox 格式

转载 作者:太空狗 更新时间:2023-10-29 11:22:43 24 4
gpt4 key购买 nike

在 OTRS 中,我有一个包含电子邮件的数据库。我在名为“article_plain”的表中有原始电子邮件(eml 格式)。

我可以使用如下语句轻松转储此内容:

SELECT ap.body FROM article_plain ap 
INNER JOIN article a ON (a.id = ap.article_id)
INNER JOIN ticket t ON (a.ticket_id = t.id)
INNER JOIN queue q ON (t.queue_id = q.id)
WHERE q.name LIKE '%something%'
LIMIT 10;

使用命令行:

mysql -u root otrs -pmypassword --silent --skip-column-names --raw -e 
"select ap.body from article_plain ap inner join article a on (a.id = ap.article_id) inner join ticket t on (a.ticket_id = t.id) inner join queue q on (t.queue_id = q.id) where q.name like '%something%' limit 10;"
>> ./emlconcat_something

我现在已将串联的 eml 文件导出到一个文件中。这看起来像:

X-Mimeole: Produced By Microsoft Exchange V6.5 Received: from xxxxxxxx.org.za ([10.0.50.12]) by xxxxxx.xxxxxx.org.za with Microsoft SMTPSVC(6.0.3790.4675); Tue, 28 Sep 2010 11:20:22 +0200 MIME-Version: 1.0 Content-Type: multipart/related; type="multipart/alternative"; boundary="----_=_NextPart_001_01CB5EEE.613E57EA" Received: from xxxxxx.xxxxxxx.co.za ([41.208.19.106]) by xxxxxxxx.org.za with SMTP; 28 Sep 2010 09:27:03 +0000 Received: from mail.dtss.co.za (mail.xxxxx.co.za [196.4.89.13]) by xxxxx.xxxxxxx.co.za; Tue, 28 Sep 2010 11:27:00 +0200 Received: from xxxxx-xxxxx.xxxxxx.org.za ([172.16.252.23]) by mail.dtss.co.za with Microsoft SMTPSVC(6.0.3790.4675); Tue, 28 Sep 2010 11:30:44 +0200 Content-Class: urn:content-classes:message Subject: RE: Some subject Date: Tue, 28 Sep 2010 11:24:31 +0200 Message-ID: <7918418270AAB64A84F55F47027EC3135FC0F0@xxx.xxx.xxxx.org.za> X-MS-Has-Attach: yes X-MS-Tnef-Correlator: Thread-Topic: Global Whatever Thread-Index: ActeL4wmcWmZ5plSTzSDPA18WuxM7AAvyzQA References: <01BD0A17B3803A48A04E613E35E0513D4E6C54@xxxxxxxxxx.local> From: "xxxx xxxxxxxx (Gauteng North, Hatfield)" To: "Nellie" , "xxxxxxx xxxxxx" CC: "xxxxx xxxxx" , "xxxxx xxxxxx" , "xxxxx xxxxx" , "xxxx xxxxx (Centurion)" , "xxxx xxxxxx (Gauteng North, Hatfield)"

This is a multi-part message in MIME format.

------_=_NextPart_001_01CB5EEE.613E57EA Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01CB5EEE.613E57EA"

------_=_NextPart_002_01CB5EEE.613E57EA Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Dear Whomever

所有其他电子邮件都只是连接到第一个(根据初始 select 语句)。

问题:
如何将其转换为 mbox 或 maildir 格式?
IE。我应该在 Linux 服务器上使用什么脚本来做到这一点?

最佳答案

一种解决方案是使用 csplit

例子:

csplit -z -k mail_export_file "/Mimeole/" {*}

理想情况下,“Mimeole”部分应该扩展,但我不擅长正则表达式,因此我将其留给读者作为练习。

关于linux - 将简单的 emaildump 转换为 maildir 或 mbox 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13952507/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com