如何使用imap命令获取具有部件号的邮件结构 [英] HOW to get mail structure with part number using imap command

查看:205
本文介绍了如何使用imap命令获取具有部件号的邮件结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

电子邮件的几个部分由RFC822定义。我认为RFC822的不同实现应该有不同的邮件结构。那么,如何使用imap命令获取带有部件号的邮件结构?

There are several parts for an email which is defined by RFC822. I think that there should be different stuctures of a mail for different implementation of RFC822. Well, how to get mail structure with part numbers using imap command?

我有一篇文章这里,这是说:

I have get an article here, which is said:

Message structure

The structure of an email message is generally something like this, with part numbers:

1 - Multipart/alternative headers
1.1 - Plain text message
1.2 - HTML version of message
2 - Inline attachment, etc

In Apple Mail it's like this instead:

1 - Plain text message
2 - Multipart/alternative headers
2.1 - HTML version of the message
2.2 - Inline attachment, etc

If the message has been forwarded, then it will look like this:

1 - Multipart/alternative headers
1.1 - Plain text message
1.2 - HTML version of message
2 - Message/RFC822
2.0 - Attached message header
2.1 - Plain text message
2.2 - HTML version of message
2.3 - Inline attachment, etc

Apple Mail does it differently again, and it's more complicated. I won't bother showing it here.

例如,我想知道gmail的结构。有没有imap命令可以做到这一点?那么还有一些其他的替代方法呢,比如pop命令,还是别的什么?

For example, I want to know the structure of gmail. Is there any imap commands can doing this? well, some other alternative way will be fine either, such as pop command or something else?

推荐答案

您正在寻找 FETCH(BODYSTRUCTURE) 命令。它不会包含任何数字,因为这些信息是隐含的 - IMAP客户端应该解析 c $ c> BODYSTRUCTURE 数据并推断实际从结果数据结构的部件号。只是看看有趣的部分的偏移。

You are looking for the FETCH (BODYSTRUCTURE) command. It will not include any numbers because that piece of information is implicitly present -- an IMAP client is supposed to parse the BODYSTRUCTURE data and infer the actual part number from the resulting data structure. Just look at the offset of the interesting part.

由于某些部分被指定为而不是直接编号,这更复杂一些;即 multipart / * ,它符合消息/ rfc822 的正文,获取自己的号码,而是可以作为数字的父母 .TEXT

It's a bit more complicated due to the way certain parts are specified to not be directly numbered; i.e. a multipart/* which consitutes the body of a message/rfc822 does not get its own number, but is instead accessible as number-of-its-parent.TEXT.

这篇关于如何使用imap命令获取具有部件号的邮件结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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