简体   繁体   English

为什么javamail API会有一系列发件人的消息?

[英]Why does javamail API have an array of senders for messages?

i need to use some sort of a port to javaMail (link here ) that takes messages from an email server (gmail in my case, but might change in the future) , and reads some information from them. 我需要使用某种类型的javaMail端口( 在此处链接),该端口从电子邮件服务器(以我的情况为gmail,但将来可能会更改)接收消息,并从中读取一些信息。

one of the things i've noticed in the API is that getFrom method returns an array of Address objects , as shown here . 我在API中已经注意到的事情之一是,GETFROM方法返回地址对象的数组,如图所示这里

my question is : in which cases would this method return : 我的问题是:在什么情况下此方法会返回:

  1. null 空值
  2. empty array 空数组
  3. more than 1 sender 多个发件人

?

all of my emails always had exactly one sender , no matter how weird it was sent (CC,BCC,forward,...) . 我的所有电子邮件始终只有一个发件人,无论发送的方式多么奇怪(CC,BCC,forward,...)。

they say there "In certain implementations, this may be different from the entity that actually sent the message." 他们说:“在某些实现中,这可能与实际发送消息的实体不同。” , so how could i know for sure who sent the message, and if the current implementation is fine? ,那么我如何才能确定是谁发送了消息,以及当前的实现是否还可以呢?

The frist two are DIRECTLY from the api: 第两个是直接来自api:

(This attribute = the 'from' attribute of the email in question) (此属性=相关电子邮件的“发件人”属性)

1) This method returns null if this attribute is not present in this message. 1) This method returns null if this attribute is not present in this message.

2) Returns an empty array if this attribute is present, but contains no addresses. 2) Returns an empty array if this attribute is present, but contains no addresses.

3) It checks the 'from' field of the email and returns an array of Address objects with one Address per entity found in that field. 3)它检查电子邮件的“发件人”字段,并返回一个地址对象数组,每个对象在该字段中找到一个地址。 So, it will return an array of size > 1 when there is more than one 'sender' listed 因此,当列出多个“发件人”时,它将返回一个大小> 1的数组

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

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