Platforms to show: All Mac Windows Linux Cross-Platform

Back to MimeEmailMBS class.

MimeEmailMBS.Attachments as MimeAttachmentMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method EmailParser MBS CURL Plugin 15.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The array of attachments.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.eml")
Var m as new MimeEmailMBS(f)

MsgBox str(m.Attachments.Ubound+1)+" attachments and "+str(m.Inlines.Ubound+1)+" inlines"

for each a as MimeAttachmentMBS in m.Inlines
MsgBox "Inline: " + a.Filename
next

See also:

MimeEmailMBS.Attachments(index as Integer) as MimeAttachmentMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method EmailParser MBS CURL Plugin 15.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries attachment by index.

Index is zero based.

See also:

MimeEmailMBS.Constructor(Content as MemoryBlock)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method EmailParser MBS CURL Plugin 15.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Parses an email from a memoryblock.

See also:

MimeEmailMBS.Constructor(Content as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method EmailParser MBS CURL Plugin 15.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Parses an email from a string.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.eml")
Var b as BinaryStream = BinaryStream.Open(f)
Var s as string = b.Read(b.Length)
Var m as new MimeEmailMBS(s)

MsgBox m.Subject

This is to parse raw email text, e.g. eml file.
To parse emlx, open the text file and read the first line. The first line contains the length of the email. Then read the following number of bytes of that value and that is the eml content. Followed by a plist structure.

See also:

MimeEmailMBS.Constructor(File as FolderItem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method EmailParser MBS CURL Plugin 15.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Parses an email from a text file.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.eml")
Var m as new MimeEmailMBS(f)

MsgBox m.Subject

You can pass here an EML file.

See also:

MimeEmailMBS.Inlines as MimeAttachmentMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method EmailParser MBS CURL Plugin 15.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The array of inline items.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.eml")
Var m as new MimeEmailMBS(f)

MsgBox str(m.Attachments.Ubound+1)+" attachments and "+str(m.Inlines.Ubound+1)+" inlines"

for each a as MimeAttachmentMBS in m.Inlines
MsgBox "Inline: " + a.Filename
next

Inline items are like attachments, but shown in the email and normally referenced by ID from the html text.

See also:

Some examples using this method:

MimeEmailMBS.Inlines(index as Integer) as MimeAttachmentMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method EmailParser MBS CURL Plugin 15.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries inline by index.

Index is zero based.

See also:

MimeEmailMBS.SourceWithoutAttachments as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method EmailParser MBS CURL Plugin 25.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns the source of the email without attachments.
Example
Var f As New FolderItem("/Users/cs/Desktop/test.eml", FolderItem.PathModes.Native)
Var m As New MimeEmailMBS(f)

// get original source and a variant without attachments.
Var s1 As String = m.Source
Var s2 As String = m.SourceWithoutAttachments

// normalize line endings for split
s1 = ReplaceLineEndings(s1, EndOfLine)
s2 = ReplaceLineEndings(s2, EndOfLine)

Var l1() As String = s1.Split(EndOfLine)
Var l2() As String = s2.Split(EndOfLine)

MessageBox _
"original "+s1.Bytes.ToString+" bytes and "+l1.Count.toString + " lines" + _
"without attachments "+s2.Bytes.ToString+" bytes and "+l2.Count.toString + " lines"

// without attachments, the number of bytes and lines should be much smaller.

The plugin passes the email, removes attachments and produces this source for you.
Can be useful to archive emails without attachments.

The items on this page are in the following plugins: MBS CURL Plugin.


The biggest plugin in space...