MailBee.NET MIME Component

MailBee.NET MIME Component

Create and parse e-mails in MIME format, work with attachments, plain-text and HTML body, embedded pictures, and headers
MailBee.NET Objects bundle includes SMTP, POP3, IMAP, EWS, Security, Antispam, Outlook Converter, Address Validator, PDF components and also BounceMail, HTML, MIME, ICalVCard components which are a free functionality.

MailBee.NET MIME is a set of classes which let your .NET applications create or parse e-mails in a text-based RFC2822 format which is used to send or receive e-mails via SMTP, POP3, and IMAP protocols. It's considered a supporting functionality and available with any licensed component of MailBee.NET Objects family at no additional cost.

When creating a new message, you can set any headers including To, CC, BCC, From, Reply-To, Return-Path, Subject, Date, Priority, use custom headers, international charsets, plain-text and HTML body, custom bodies like XML or calendar event, import HTML and automatically attach (embed) any related resources like pictures, add attachments from files and memory, attach nested e-mails:

// Create new message, assign sender and recipient.
MailMessage msg = new MailMessage();
msg.From.AsString = "John Doe <john.doe@domain.com>";
msg.To.AsString = "Jane Doe <jane.doe@company.com>";
// Enable international characters in the message.
msg.Charset = "utf-8";
// Set subject and HTML body.
msg.Subject = "Non-english characters in subject";
msg.BodyHtmlText = "<html><body><i>Italic</i> <b>bold</b>.</body></html>";
// Create plain-text version of HTML body.
msg.MakePlainBodyFromHtmlBody();
// Send it! In real apps, you should create Smtp object and use Send method.
Smtp.QuickSend(msg);
' Create new message, assign sender and recipient.
Dim msg As MailMessage = New MailMessage()
msg.From.AsString = "John Doe <john.doe@domain.com>"
msg.To.AsString = "Jane Doe <jane.doe@company.com>"
' Enable international characters in the message.
msg.Charset = "utf-8"
' Set subject and HTML body.
msg.Subject = "Non-english characters in subject"
msg.BodyHtmlText = "<html><body><i>Italic</i> <b>bold</b>.</body></html>"
' Create plain-text version of HTML body.
msg.MakePlainBodyFromHtmlBody()
' Send it! In real apps, you should create Smtp object and use Send method.
Smtp.QuickSend(msg)
The code above assumes that MailBee, MailBee.Mime, and MailBee.SmtpMail namespaces are declared ("using" in C#, "Imports" in VB) and MailBee.SmtpMail.Smtp.LicenseKey is already set in the registry, app.config, or directly in the code.

You can also post-process the message (e.g. generate plain-text version of HTML body or sign the e-mail with DKIM and DomainKeys signatures), or use mail merge to quickly generate the message based on a template.

The resulting message can be sent out with MailBee.NET SMTP component, uploaded to a folder on IMAP server, or you can save it into a file, stream or memory. With the help of S/MIME class (requires Security license), you can also digitally sign or encrypt the message.

When parsing an existing message which you may have received with MailBee.NET POP3 or MailBee.NET IMAP component or simply loaded from a file or memory, you have access to any part or header of the whole message or any of its sub-parts. You can examine all the recipients, headers, text bodies, save attachments, save all embedded pictures and adjust HTML body in order to properly display it in the web browser.

You can also pre-process the message data such as check its DKIM and DomainKeys signatures, create HTML version of plain-text to display it on the web page, make all links open in a new window, or create plain-text from HTML to display HTML-only e-mail in plain-text:

// Download last e-mail in inbox.
MailMessage msg = Pop3.QuickDownloadMessage("mail.domain.com", "user", "password", -1);
// Make plain-text from HTML if the e-mail contains only HTML part.
msg.Parser.HtmlToPlainMode = HtmlToPlainAutoConvert.IfNoPlain;
// Display the plain-text version of the e-mail.
Console.WriteLine(msg.BodyPlainText);
' Download last e-mail in inbox.
Dim msg As MailMessage = Pop3.QuickDownloadMessage("mail.domain.com", "user", "password", -1)
' Make plain-text from HTML if the e-mail contains only HTML part.
msg.Parser.HtmlToPlainMode = HtmlToPlainAutoConvert.IfNoPlain
' Display the plain-text version of the e-mail.
Console.WriteLine(msg.BodyPlainText)
The code above assumes that MailBee, MailBee.Mime, and MailBee.Pop3Mail namespaces are declared ("using" in C#, "Imports" in VB) and MailBee.Pop3Mail.Pop3.LicenseKey is already set in the registry, app.config, or directly in the code.
Current version: 11.0 Last update: 14 March 2017

MailBee.NET MIME can parse incomplete e-mails (for instance, if you received only the message header or the header and several lines of the body), incorrectly formatted e-mails (created with low-quality mail programs), complex e-mails which contain nested e-mails (e.g. e-mails forwarded as attachment), e-mails with MS-TNEF (winmail.dat) attachments.

With the help of S/MIME class (requires Security license), you can also verify digital signature or decrypt encrypted message.

You can even parse an existing e-mail, adjust it (for instance, forward or reply it) and then send it out. Thus, parsing and composing can be parts of the same process.

All operations take place directly in memory, no temp files used unless specifically selected by the application (MailBee.NET HTML has the mode which allows the application to get any e-mail as an HTML file).

If you need to work with Outlook .MSG e-mails (binary format), you can use MailBee.NET Outlook Converter to convert them into text-based MIME format or vice versa.

Features (creating e-mail)

  • Can set To, CC, BCC recipients from comma-delimited strings or separately for every recipient
  • Can set From, Reply-To, Return-Path (different From and actual sender)
  • Friendly names in e-mail addresses
  • International characters and encodings in headers (including UTF-8)
  • Subject, Priority, Importance, ConfirmRead, ConfirmReceipt, Sensitivity, Date, MessageID
  • Plain-text, HTML, custom-format text body including XML, calendar and so on, alternative text bodies
  • Can auto-create plain-text version of HTML
  • International characters and encodings in the body (including UTF-8)
  • Multiple attachments, international filenames, different names on the filesystem and in the message
  • Memory attachments (from stream, byte array, another message)
  • Files and resources referenced in HTML body are automatically imported and attached
  • Flexible mail merge functionality (also, there is mail merge over database with the help of MailBee.NET SMTP)
  • Can sign with DomainKeys and DKIM
  • Can sign and encrypt with S/MIME (requires Security license)
  • Sends the resulting e-mail via SMTP, upload via IMAP, submit to MailBee.NET Queue, save into file or memory
  • XML serialization
  • System.Net.Mail.MailMessage interoperability

Features (parsing e-mail)

  • Loads message from a file, stream or memory, gets it from MailBee.NET POP3 or MailBee.NET IMAP
  • Deserializes message from XML or import from System.Net.Mail.MailMessage
  • Access to any headers of the root message or any of its subparts
  • Access to To, CC, BCC recipients as comma-delimited strings or separately for every recipient
  • Friendly names in e-mail addresses
  • Subject, Priority, Importance, ConfirmRead, ConfirmReceipt, Sensitivity, Date, MessageID
  • Timestamps (Received headers). Lets the application know when the message was received
  • Supports base64, quoted-printable, UUE
  • Automatically decodes data which uses international encodings (charsets)
  • Access to any part of the message or messages nested within it
  • Plain-text, HTML, custom-format text body including XML, calendar and so on, alternative text bodies
  • Can auto-create plain-text version of HTML (to display HTML in plaintext-only container like the console)
  • Can auto-create HTML version of plain-text (to display plain-text in HTML-only container like the web browser)
  • Several modes of saving embedded pictures for different scenarios
  • Access to any attachment and its properties, save to disk, memory, or save all attachments to a folder
  • Attachments with international filenames
  • Supports attachments embedded directly in the message body text (UUE-encoded, FIDO-like)
  • Supports MS-TNEF (winmail.dat) attachments
  • Can verify DomainKeys and DKIM signatures
  • Can verify digital signature and decrypt with S/MIME (requires Security license)

Mime reference...

This is what you can do with licensed MailBee.NET components and MailBee.NET MIME:

  • POP3 - download e-mails from POP3 server and parse them.
  • IMAP - download e-mails from IMAP server or upload e-mails there.
  • SMTP - send composed e-mails to SMTP server or submit them to MailBee.NET Queue.
  • Security (Smime class) - use S/MIME to encrypt, decrypt, digitally sign or verify digital signature.
  • AntiSpam - check if the e-mail is spam.
  • Outlook - convert e-mail between MIME and Outlook .MSG formats or read .PST files.

You can also use free MailBee.NET HTML Component together with MailBee.NET MIME to pre- or post-process HTML e-mails in sophisticated ways (for instance, remove all unsafe content like javascript or iframe tags from HTML body).

Visual Studio

Xamarin

Written in 100% managed code, MailBee.NET MIME only requires the .NET framework to be installed on the computer.

MailBee.NET MIME can be used in any .NET language including C# and VB.NET. Supported .NET frameworks include .NET 2.0/3.0/3.5/4.0/4.5/4.6, both 32-bit and 64-bit.

MailBee.NET also supports .NET Core 1.0/1.1 including ASP.NET Core and Xamarin, UWP (Universal Windows).

Clients Say:

"I've been looking at the MailBee.NET application and love it." Matt Yeager
"Thanks again for your help. I like your products..." Ron Hill
"By the way I love your software. Great work thank you." Dennis Drogemuller