MimeMessage class
A MIME message
Constructors
Properties
-
allPartsFlat
→ List<
MimePart> -
Puts all parts of this message into a flat sequential list.
no setter
-
bcc
↔ List<
MailAddress> ? -
getter/setter pair
- body ↔ BodyPart?
-
The body structure of the message.
getter/setter pair
-
cc
↔ List<
MailAddress> ? -
getter/setter pair
- envelope ↔ Envelope?
-
The envelope of the message.
getter/setter pair
-
flags
↔ List<
String> ? -
Message flags like \Seen, \Recent, etc
getter/setter pair
-
from
↔ List<
MailAddress> ? -
according to RFC 2822 section 3.6.2. there can be more than one FROM address, in that case the sender MUST be specified
getter/setter pair
- fromEmail → String?
-
The email of the first from address of this message
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
↔ List<
Header> ? -
The
headers
field contains all message(part) headersgetter/setter pairinherited - internalDate ↔ String?
-
The internal date of the message on the recipient's provider server
getter/setter pair
- isAnswered ↔ bool
-
Checks if this message has been replied
getter/setter pair
- isDeleted ↔ bool
-
Checks if this message has been marked as deleted
getter/setter pair
- isDownloaded → bool
-
Checks if this message contents has been downloaded
no setter
- isFlagged ↔ bool
-
Checks if this message has been marked as important / flagged
getter/setter pair
- isForwarded ↔ bool
-
Checks if this message has been forwarded
getter/setter pair
- isMdnSent ↔ bool
-
Checks if a read receipt has been sent for this message
getter/setter pair
- isReadReceiptRequested → bool
-
Checks if a disposition notification message is requested.
no setter
- isReadReceiptSent ↔ bool
-
Checks if a read receipt has been sent for this message
getter/setter pair
- isSeen ↔ bool
-
Checks if this message has been read
getter/setter pair
- mediaType → MediaType
-
Simplified way to retrieve the media type
When no
content-type
header is defined, the media typetext/plain
is returnedno setterinherited - mimeData ↔ MimeData?
-
The raw message data of this part. May or may not include headers, depending on retrieval.
getter/setter pairinherited
- modSequence ↔ int?
-
The modifications sequence of this message.
This is only returned by servers that support the CONDSTORE capability and can be fetch explicitely with 'MODSEQ'.
getter/setter pair
-
parts
↔ List<
MimePart> ? -
The children of this part, if any.
getter/setter pairinherited
-
recipientAddresses
→ List<
String> -
Retrieves the mail addresses of all message recipients
no setter
-
replyTo
↔ List<
MailAddress> ? -
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sender ↔ MailAddress?
-
getter/setter pair
- sequenceId ↔ int?
-
The index of the message, if known
getter/setter pair
- size ↔ int?
-
The size of the message in bytes
getter/setter pair
- threadSequence ↔ MessageSequence?
-
The thread sequence, this can be populated manually or with MailClient.fetchThreadData.
getter/setter pair
-
to
↔ List<
MailAddress> ? -
getter/setter pair
- uid ↔ int?
-
The uid of the message, if known
getter/setter pair
Methods
-
addFlag(
String name) → void -
Adds the flag with the specified
name
to this message. -
addHeader(
String name, String? value, [HeaderEncoding encoding = HeaderEncoding.none]) → void -
Adds a header with the specified
name
,value
and optionalencoding
.inherited -
addPart(
MimePart part) → void -
inherited
-
collectContentInfo(
ContentDisposition disposition, List< ContentInfo> result, String? fetchId, {bool? reverse, bool? complete}) → void -
Adds the matching disposition header with the specified
disposition
of this part and this children parts to theresult
.inherited -
copyIndividualParts(
MimeMessage other) → void -
decodeContentBinary(
) → Uint8List? -
Decodes the binary data of this part.
inherited
-
decodeContentMessage(
) → MimeMessage? -
Decodes a message/rfc822 part
inherited
-
decodeContentText(
) → String? -
Decodes the text of this part.
inherited
-
decodeDate(
) → DateTime? -
Decodes the message 'date' header to local time.
inherited
-
decodeFileName(
) → String? -
Tries to find and decode the associated file name
inherited
-
decodeHeaderDateValue(
String name) → DateTime? -
Decodes the a date value of the first matching header
inherited
-
decodeHeaderMailAddressValue(
String name) → List< MailAddress> ? -
Decodes the email address value of first matching header
inherited
-
decodeHeaderValue(
String name) → String? -
Decodes the value of the first matching header
inherited
-
decodeSender(
{bool combine = false}) → List< MailAddress> -
Retrieves the sender of the this message by checking the
reply-to
,sender
andfrom
header values in this order. Setcombine
totrue
in case you want to combine the addresses from these headers, by default the first non-emptry entry is returned. -
decodeSubject(
) → String? - Decodes the subject of this message
-
decodeTextHtmlPart(
) → String? -
Tries to find a 'content-type: text/html' part and decodes its contents when found.
override
-
decodeTextPlainPart(
) → String? -
Tries to find a 'content-type: text/plain' part and decodes its contents when found.
override
-
findContentInfo(
{ContentDisposition disposition = ContentDisposition.attachment, bool? withCleanParts, bool? complete}) → List< ContentInfo> -
Retrieves all content info of parts with the specified
disposition
Content-Type
. By default the content info withContentDisposition.attachment
are retrieved. Typically this used to list all attachments of a message. Note that either the message contents (BODY[]
) or theBODYSTRUCTURE
is required to reliably list all matching content elements. All fetchId parsed from theBODYSTRUCTURE
are returned in a form compatible with the body parts tree unlesswithCleanParts
is false. -
findRecipient(
MailAddress recipient, {List< MailAddress> ? aliases, bool allowPlusAliases = false}) → MailAddress? -
Finds the matching
recipient
address. Optionally specify knownaliases
and setallowPlusAliases
totrue
to allow aliass such asme+alias@domain.com
. -
findSender(
MailAddress sender, {List< MailAddress> ? aliases, bool allowPlusAliases = false}) → MailAddress? -
Finds the matching
sender
address. Optionally specify knownaliases
and setallowPlusAliases
totrue
to allow aliass such asme+alias@domain.com
. -
getHeader(
String name) → Iterable< Header> ? -
Retrieves all matching headers with the specified
name
.inherited -
getHeaderContentDisposition(
) → ContentDispositionHeader? -
Retrieves the first 'content-disposition' header.
inherited
-
getHeaderContentType(
) → ContentTypeHeader? -
Retrieves the first 'content-type' header.
override
-
getHeaderValue(
String name) → String? -
Retrieves the raw value of the first matching header.
inherited
-
getPart(
String fetchId) → MimePart? -
Retrieves the part with the specified
fetchId
. -
getPartWithContentId(
String cid) → MimePart? -
Retrieves the part with the specified Content-ID
cid
. -
getPartWithMediaSubtype(
MediaSubtype subtype) → MimePart? -
Searches the MimePart with the specified
subtype
.override -
hasAttachments(
) → bool -
Checks if this message has parts with a
Content-Disposition: attachment
header. -
hasAttachmentsOrInlineNonTextualParts(
) → bool - Checks if this message contains either explicit attachments or non-textual inline parts.
-
hasContent(
ContentDisposition disposition) → bool -
Checks if this message has parts with the specified
disposition
. Note that either the full message or the body structure must have been downloaded before. -
hasFlag(
String name) → bool -
Checks if the messages has the message flag with the specified
name
. -
hasHeader(
String name) → bool -
Checks if this MIME part has a header with the specified
name
.inherited -
hasInlineParts(
) → bool - Checks if this message any inline parts.
-
hasPart(
MediaSubtype subtype, {int? depth}) → bool -
Checks if this MIME part or a child is of the specified media type
inherited
-
hasTextPart(
{int? depth}) → bool -
Checks if this MIME part or a child is textual.
inherited
-
insertPart(
MimePart part) → void -
inherited
-
isFrom(
MailAddress sender, {List< MailAddress> ? aliases, bool allowPlusAliases = false}) → bool -
Checks of this messagin is from the specified
sender
address. Optionally specify knownaliases
and setallowPlusAliases
totrue
to allow aliass such asme+alias@domain.com
. SetallowPlusAliases
totrue
in case + aliases likeme+alias@domain.com
are valid. -
isTextMediaType(
) → bool -
Checks if this MIME part is textual.
inherited
-
isTextMessage(
) → bool - Checks if this is a typical text message Compare isTextPlainMessage Compare decodeTextPlainPart Compare decodeTextHtmlPart
-
isTextPlainMessage(
) → bool - Checks if this is a typical text message with a plain text part Compare decodeTextPlainPart Compare isTextMessage
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parse(
) → void -
Parses this and all children MIME parts.
inherited
-
removeFlag(
String name) → void -
Removes the flag with the specified
name
from this message. -
removeHeader(
String name) → void -
Removes the header with the specified
name
.inherited -
render(
StringBuffer buffer, {bool renderHeader = true}) → void -
Renders this mime part with all children parts into the specified
buffer
.inherited -
renderMessage(
{bool renderHeader = true}) → String - Renders the complete message into a String.
-
setFlag(
String name, bool enable) → void -
Adds or removes the flag with the specified
name
to/from this message depending onvalue
. -
setHeader(
String name, String? value, [HeaderEncoding encoding = HeaderEncoding.none]) → void -
Sets a header with the specified
name
,value
and optionalencoding
, replacing any existing header with the samename
.inherited -
setPart(
String fetchId, MimePart part) → void -
Sets the individually loaded
part
with the givenfetchId
. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
parseFromData(
Uint8List data) → MimeMessage - Creates a new message based on the specified binary data. Compare renderMessage method for converting a message to text.
-
parseFromText(
String text) → MimeMessage - Creates a new message based on the specified rendered text form.