简体   繁体   English

如何使用Delphi从Thunderbird获取电子邮件消息

[英]How to use Delphi to get email message text from Thunderbird

What I do now with Outlook: 我现在用Outlook做什么:

I receive email orders for products. 我收到产品的电子邮件订单。 I select a single or multiple emails in Outlook (a single order can have multiple emails associated with it) and then switch to my Delphi coded OrderManager program and click "Import". 我在Outlook中选择一个或多个电子邮件(一个订单可以有多个与之关联的电子邮件),然后切换到我的Delphi编码的OrderManager程序并单击“导入”。 It uses Outlook's COM automation interface to read the text of each message, parses and processes each one. 它使用Outlook的COM自动化界面来读取每条消息的文本,解析并处理每条消息。

The question is, can I do this using Thunderbird instead? 问题是,我可以使用Thunderbird代替吗? Does Thunderbird have a COM interface? Thunderbird有COM接口吗? I must be googling the wrong keywords because I haven't found anything yet. 我必须使用Google搜索错误的关键字,因为我还没有找到任何内容。

Btw, I do have a version of my OrderManager that just reads the emails directly from my email server using Indy, but for several reasons I'd like to try to read them from Firefox. 顺便说一句,我确实有一个版本的OrderManager,它只是使用Indy从我的电子邮件服务器直接读取电子邮件,但出于几个原因,我想尝试从Firefox中读取它们。

Any suggestions, links to docs, or code samples will be greatly appreciated! 任何建议,文档链接或代码示例将不胜感激!

Check this link out. 检查此链接

You could write a C or C++ wrapper around XPCOM and then use that wrapper within Delphi. 您可以围绕XPCOM编写C或C ++包装器,然后在Delphi中使用该包装器。

There is also an open source XPCOM wrapper written in Delphi . 还有一个用Delphi编写的开源XPCOM包装器 You might want to check that out as well. 您可能也想检查一下。 Thanks Stijn for pointing that out. 感谢Stijn指出这一点。

Hope it helps. 希望能帮助到你。

You could also parse Thunderbird's mailbox files yourself. 您也可以自己解析Thunderbird的邮箱文件。

  • From %APPDATA%\\Thunderbird\\profiles.ini , read where the profile folder is located (if there's more than one profile, look through sections Profile 0 .. Profile n for the one that has the value Default=1 ) %APPDATA%\\Thunderbird\\profiles.ini ,读取配置文件文件夹所在的位置(如果有多个配置文件,请查看Profile 0Profile n ,以获取值为Default=1
  • Each subfolder of the Mail and/or ImapMail subfolders of the profile folder represents an account ( Mail contains POP accounts, ImapMail contains IMAP accounts); 配置文件文件夹的Mail和/或ImapMail子文件夹的每个子文件夹代表一个帐户( Mail包含POP帐户, ImapMail包含IMAP帐户);
  • Look through all files whose names don't end with .dat or .msf, and whose contents start with 'From ' (F, r, o, m, and a space). 通过看他们的名字不.DAT或.msf, 并且其内容以“从”(F,R,O,M和空格)结尾的所有文件。 Those are the mailbox files . 那些是邮箱文件
  • Every line that starts with ' From ' indicates a new message. 以“ From ”开头的每一行都表示一条新消息。 Use the X-Mozilla-Status header to figure out whether the message is still valid, or whether it's been marked for deletion. 使用X-Mozilla-Status标头来确定消息是否仍然有效,或者是否已将其标记为删除。 (You can use the CDO.Message COM object to parse the message for you, if you want). (如果需要,可以使用CDO.Message COM对象为您解析消息)。

You should recurse for each subfolder ending on '.sbd', since that will contain that mailbox's subfolders (Eg Inbox.sbd will contain the mail folders under the Inbox). 您应该递归以“.sbd”结尾的每个子文件夹,因为它将包含该邮箱的子文件夹(例如Inbox.sbd将包含收件箱下的邮件文件夹)。

Be wary of file locking issues, however. 但是要小心文件锁定问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM