Record Class ParsedMessage

java.lang.Object
java.lang.Record
cloud.opencode.base.email.protocol.mime.ParsedMessage
Record Components:
messageId - the Message-ID header value | Message-ID 邮件头值
from - the sender email address | 发件人邮箱地址
fromName - the sender display name (nullable) | 发件人显示名称
to - the recipient addresses | 收件人地址列表
cc - the CC addresses | 抄送地址列表
bcc - the BCC addresses | 密送地址列表
replyTo - the Reply-To address (nullable) | 回复地址
subject - the decoded subject | 解码后的主题
textContent - the plain text body (nullable) | 纯文本正文
htmlContent - the HTML body (nullable) | HTML正文
sentDate - the sent date (from Date header, nullable) | 发送日期
receivedDate - the received date (from Received header, nullable) | 接收日期
size - the total message size in bytes | 消息总字节大小
headers - all parsed headers as name-value pairs | 所有解析的邮件头
attachments - the parsed attachments | 解析的附件列表

public record ParsedMessage(String messageId, String from, String fromName, List<String> to, List<String> cc, List<String> bcc, String replyTo, String subject, String textContent, String htmlContent, Instant sentDate, Instant receivedDate, int size, Map<String,String> headers, List<ParsedMessage.ParsedAttachment> attachments) extends Record
Parsed MIME Message Record 已解析的 MIME 消息记录

Immutable result of parsing a raw RFC 2822 MIME message. Contains all extracted headers, body content (plain text and/or HTML), sent/received dates, and attachments.

解析原始 RFC 2822 MIME 消息的不可变结果。包含所有提取的邮件头、消息体内容 (纯文本和/或HTML)、发送/接收日期和附件。

Features | 主要功能:

  • Extracted addresses (from, to, cc, bcc) - 提取的地址
  • Decoded subject (RFC 2047) - 解码的主题
  • Plain text and HTML body - 纯文本和HTML正文
  • Attachment data with metadata - 附件数据及元数据
  • All raw headers - 所有原始邮件头

Security | 安全性:

  • Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
  • Null-safe: Fields may be null for absent values - 缺失值的字段可能为null
Since:
JDK 25, opencode-base-email V1.0.3
Author:
Leon Soo
See Also:
  • Constructor Details

    • ParsedMessage

      public ParsedMessage(String messageId, String from, String fromName, List<String> to, List<String> cc, List<String> bcc, String replyTo, String subject, String textContent, String htmlContent, Instant sentDate, Instant receivedDate, int size, Map<String,String> headers, List<ParsedMessage.ParsedAttachment> attachments)
      Creates an instance of a ParsedMessage record class.
      Parameters:
      messageId - the value for the messageId record component
      from - the value for the from record component
      fromName - the value for the fromName record component
      to - the value for the to record component
      cc - the value for the cc record component
      bcc - the value for the bcc record component
      replyTo - the value for the replyTo record component
      subject - the value for the subject record component
      textContent - the value for the textContent record component
      htmlContent - the value for the htmlContent record component
      sentDate - the value for the sentDate record component
      receivedDate - the value for the receivedDate record component
      size - the value for the size record component
      headers - the value for the headers record component
      attachments - the value for the attachments record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • messageId

      public String messageId()
      Returns the value of the messageId record component.
      Returns:
      the value of the messageId record component
    • from

      public String from()
      Returns the value of the from record component.
      Returns:
      the value of the from record component
    • fromName

      public String fromName()
      Returns the value of the fromName record component.
      Returns:
      the value of the fromName record component
    • to

      public List<String> to()
      Returns the value of the to record component.
      Returns:
      the value of the to record component
    • cc

      public List<String> cc()
      Returns the value of the cc record component.
      Returns:
      the value of the cc record component
    • bcc

      public List<String> bcc()
      Returns the value of the bcc record component.
      Returns:
      the value of the bcc record component
    • replyTo

      public String replyTo()
      Returns the value of the replyTo record component.
      Returns:
      the value of the replyTo record component
    • subject

      public String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • textContent

      public String textContent()
      Returns the value of the textContent record component.
      Returns:
      the value of the textContent record component
    • htmlContent

      public String htmlContent()
      Returns the value of the htmlContent record component.
      Returns:
      the value of the htmlContent record component
    • sentDate

      public Instant sentDate()
      Returns the value of the sentDate record component.
      Returns:
      the value of the sentDate record component
    • receivedDate

      public Instant receivedDate()
      Returns the value of the receivedDate record component.
      Returns:
      the value of the receivedDate record component
    • size

      public int size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component
    • headers

      public Map<String,String> headers()
      Returns the value of the headers record component.
      Returns:
      the value of the headers record component
    • attachments

      public List<ParsedMessage.ParsedAttachment> attachments()
      Returns the value of the attachments record component.
      Returns:
      the value of the attachments record component