LumiSoft Net Help
Mime Class
NamespacesLumiSoft.Net.MimeMime
Class for creating,parsing,modifing rfc 2822 mime messages.
Declaration Syntax
C#Visual BasicVisual C++
[ObsoleteAttribute("See LumiSoft.Net.MIME or LumiSoft.Net.Mail namepaces for replacement.")]
public class Mime
<ObsoleteAttribute("See LumiSoft.Net.MIME or LumiSoft.Net.Mail namepaces for replacement.")> _
Public Class Mime
[ObsoleteAttribute(L"See LumiSoft.Net.MIME or LumiSoft.Net.Mail namepaces for replacement.")]
public ref class Mime
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
Mime()()()()
Default constructor.

Attachments
Gets attachment entities. Entity is considered as attachmnet if:

*) Content-Disposition: attachment (RFC 2822 message)

*) Content-Disposition: filename = "" is specified (RFC 2822 message)

*) Content-Type: name = "" is specified (old RFC 822 message)


BodyHtml
Gets message body html. Returns null if no body html text specified.

BodyText
Gets message body text. Returns null if no body text specified.

CreateSimple(AddressList, AddressList, String, String, String)
Creates simple mime message.

CreateSimple(AddressList, AddressList, String, String, String, array<String>[]()[][])
Creates simple mime message with attachments.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Finalize()()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()()
Gets the Type of the current instance.
(Inherited from Object.)
MainEntity
Message main(top-level) entity.

MemberwiseClone()()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
MimeEntities
Gets all mime entities contained in message, including child entities.

Parse(array<Byte>[]()[][])
Parses mime message from byte[] data.

Parse(String)
Parses mime message from file.

Parse(Stream)
Parses mime message from stream.

ToByteData()()()()
Stores mime message to byte[].

ToFile(String)
Stores mime message to specified file.

ToStream(Stream)
Stores mime message to specified stream. Stream position stays where mime writing ends.

ToString()()()()
Returns a String that represents the current Object.
(Inherited from Object.)
ToStringData()()()()
Stores mime message to string.

Remarks
CopyC#
Message examples:

<B>Simple message:</B>

//--- Beginning of message
From: sender@domain.com
To: recipient@domain.com
Subject: Message subject.
Content-Type: text/plain

Message body text. Bla blaa
blaa,blaa.
//--- End of message


In simple message MainEntity is whole message.

<B>Message with attachments:</B>

//--- Beginning of message
From: sender@domain.com
To: recipient@domain.com
Subject: Message subject.
Content-Type: multipart/mixed; boundary="multipart_mixed"

--multipart_mixed    /* text entity */
Content-Type: text/plain

Message body text. Bla blaa
blaa,blaa.    
--multipart_mixed    /* attachment entity */
Content-Type: application/octet-stream

attachment_data
--multipart_mixed--
//--- End of message

MainEntity is multipart_mixed entity and text and attachment entities are child entities of MainEntity.
Examples
CopyC#
// Parsing example:
Mime m = Mime.Parse("message.eml");
// Do your stuff with mime
CopyC#
// Create simple message with simple way:
AddressList from = new AddressList();
from.Add(new MailboxAddress("dispaly name","user@domain.com"));
AddressList to = new AddressList();
to.Add(new MailboxAddress("dispaly name","user@domain.com"));

Mime m = Mime.CreateSimple(from,to,"test subject","test body text","");
CopyC#
// Creating a new simple message
Mime m = new Mime();
MimeEntity mainEntity = m.MainEntity;
// Force to create From: header field
mainEntity.From = new AddressList();
mainEntity.From.Add(new MailboxAddress("dispaly name","user@domain.com"));
// Force to create To: header field
mainEntity.To = new AddressList();
mainEntity.To.Add(new MailboxAddress("dispaly name","user@domain.com"));
mainEntity.Subject = "subject";
mainEntity.ContentType = MediaType_enum.Text_plain;
mainEntity.ContentTransferEncoding = ContentTransferEncoding_enum.QuotedPrintable;
mainEntity.DataText = "Message body text.";

m.ToFile("message.eml");
CopyC#
// Creating message with text and attachments
Mime m = new Mime();
MimeEntity mainEntity = m.MainEntity;
// Force to create From: header field
mainEntity.From = new AddressList();
mainEntity.From.Add(new MailboxAddress("dispaly name","user@domain.com"));
// Force to create To: header field
mainEntity.To = new AddressList();
mainEntity.To.Add(new MailboxAddress("dispaly name","user@domain.com"));
mainEntity.Subject = "subject";
mainEntity.ContentType = MediaType_enum.Multipart_mixed;

MimeEntity textEntity = mainEntity.ChildEntities.Add();
textEntity.ContentType = MediaType_enum.Text_plain;
textEntity.ContentTransferEncoding = ContentTransferEncoding_enum.QuotedPrintable;
textEntity.DataText = "Message body text.";

MimeEntity attachmentEntity = mainEntity.ChildEntities.Add();
attachmentEntity.ContentType = MediaType_enum.Application_octet_stream;
attachmentEntity.ContentDisposition = ContentDisposition_enum.Attachment;
attachmentEntity.ContentTransferEncoding = ContentTransferEncoding_enum.Base64;
attachmentEntity.ContentDisposition_FileName = "yourfile.xxx";
attachmentEntity.DataFromFile("yourfile.xxx");
// or
attachmentEntity.Data = your_attachment_data;
Inheritance Hierarchy
Object
Mime

Assembly: LumiSoft.Net (Module: LumiSoft.Net) Version: 2.0.4006.27129