Spire.Email
6.6.0
dotnet add package Spire.Email --version 6.6.0
NuGet\Install-Package Spire.Email -Version 6.6.0
<PackageReference Include="Spire.Email" Version="6.6.0" />
paket add Spire.Email --version 6.6.0
#r "nuget: Spire.Email, 6.6.0"
// Install Spire.Email as a Cake Addin #addin nuget:?package=Spire.Email&version=6.6.0 // Install Spire.Email as a Cake Tool #tool nuget:?package=Spire.Email&version=6.6.0
.NET Library for Processing & Manipulating Email Files
Product Page 丨 Documentation 丨 Examples 丨 Forum 丨 Temporary License 丨 Customized Demo
Spire.Email for .NET is a professional .NET Email library specially designed for developers to create, read and manipulate emails from any .NET (C#, VB.NET, ASP.NET, .Net Core, .Net Standard, .NET 5.0, MonoAndroid, Xamarin iOS) platform with fast and high quality performance.As an independent .NET Email API, Spire.Email for .NET doesn't need Microsoft outlook to be installed on the machine. However, it can incorporate Microsoft Outlook document creation capabilities into any developers' .NET applications.Spire.Email for .NET enables developers to create, edit and send out the message contents with attachments. Spire.Email for .NET supports to work with a number of Outlook email message formats, such as MSG, EML, EMLX, MHTML, PST, OST and TNEF files.Developers can use Spire.Email to receive message and get the detail information of the message, such as get mailbox information, get the message count, size, list, sequence number and the unique ID.
Main Features
- Create email with HTML/Text mail body
- Add, Extract, and Delete attachment
- Load and Save messages from and to file or stream (EML, EMLX, MSG or MHTML formats)
- Email file format conversion (EML, MSG or MHTML formats)
- Send and receive emails using SMTP, POP3 and IMAP protocols
- Get mailbox and messages info, retrieve and delete messages from server using POP3 protocols
- Create, Delete, Select and Rename folders using IMAP protocols
- Manipulate outlook storage files i.e. PST and OST
Supported Formats
- Microsoft Outlook: MSG, PST, OST
- Email: EML, EMLX, TNEF, MHTML
Receive and Save Email in C#
Use POP3 client
using Spire.Email;
using Spire.Email.Pop3;
using System;
using System.Globalization;
namespace ReceiveAndSaveEmailByUsingPOP3client
{
class Program
{
static void Main(string[] args)
{
//Create a POP3 client
Pop3Client pop = new Pop3Client();
//Set host, username, password etc. for the client
pop.Host = "outlook.office365.com";
pop.Username = "LeonDavisLD@outlook.com";
pop.Password = "password";
pop.Port = 995;
pop.EnableSsl = true;
//Connect the server
pop.Connect();
//Get the first message by its sequence number
MailMessage message = pop.GetMessage(1);
//Parse the message
Console.WriteLine("------------------ HEADERS ---------------");
Console.WriteLine("From : " + message.From.ToString());
Console.WriteLine("To : " + message.To.ToString());
Console.WriteLine("Date : " + message.Date.ToString(CultureInfo.InvariantCulture));
Console.WriteLine("Subject: " + message.Subject);
Console.WriteLine("------------------- BODY -----------------");
Console.WriteLine(message.BodyText);
Console.WriteLine("------------------- END ------------------");
//Save the message to disk using its subject as file name
message.Save(message.Subject + ".eml", MailMessageFormat.Eml);
Console.WriteLine("Message Saved.");
Console.ReadKey();
}
}
}
Use IMAP client
using Spire.Email;
using Spire.Email.IMap;
using System;
using System.Globalization;
namespace ReceiveAndSaveEmailByUsingIMAPclient
{
class Program
{
static void Main(string[] args)
{
//Create an IMAP client
ImapClient imap = new ImapClient();
// Set host, username, password etc. for the client
imap.Host = "outlook.office365.com";
imap.Port = 143;
imap.Username = "LeonDavisLD@outlook.com";
imap.Password = "password";
imap.ConnectionProtocols = ConnectionProtocols.Ssl;
//Connect the server
imap.Connect();
//Select Inbox folder
imap.Select("Inbox");
//Get the first message by its sequence number
MailMessage message = imap.GetFullMessage(1);
//Parse the message
Console.WriteLine("------------------ HEADERS ---------------");
Console.WriteLine("From : " + message.From.ToString());
Console.WriteLine("To : " + message.To.ToString());
Console.WriteLine("Date : " + message.Date.ToString(CultureInfo.InvariantCulture));
Console.WriteLine("Subject: " + message.Subject);
Console.WriteLine("------------------- BODY -----------------");
Console.WriteLine(message.BodyText);
Console.WriteLine("------------------- END ------------------");
//Save the message to disk using its subject as file name
message.Save(message.Subject + ".eml", MailMessageFormat.Eml);
Console.WriteLine("Message Saved.");
Console.ReadKey();
}
}
}
Convert EML/EMLX to MHTML or MSG in C#
Convert EML/EMLX to MHTML
using Spire.Email;
using System;
namespace ConvertEMLandEMLXtoMHTML
{
class Program
{
static void Main(string[] args)
{
MailMessage message = MailMessage.Load("example.eml");
message.Save("ToMhtml.mhtml", MailMessageFormat.Mhtml);
Console.WriteLine("Done");
}
}
}
Convert EML/EMLX to MSG
using Spire.Email;
using System;
namespace ConvertEMLandEMLXtoMSG
{
class Program
{
static void Main(string[] args)
{
MailMessage message = MailMessage.Load("example.eml");
message.Save("ToMsg.msg", MailMessageFormat.Msg);
Console.WriteLine("Done");
}
}
}
Product Page 丨 Documentation 丨 Examples 丨 Forum 丨 Temporary License 丨 Customized Demo
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETStandard 2.0
- SkiaSharp (>= 1.68.0)
- System.Text.Encoding.CodePages (>= 4.5.0)
-
net6.0
- System.Drawing.Common (>= 6.0.0)
- System.Text.Encoding.CodePages (>= 6.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Spire.Email:
Package | Downloads |
---|---|
Spire.Office
Spire.Office for .NET is a combination of Enterprise-Level Office .NET components offered by E-iceblue. It includes Spire.Doc, Spire XLS, Spire.Presentation, Spire.PDF, Spire.DataExport, Spire.PDFViewer, Spire.DocViewer, Spire.Email and Spire.BarCode. Spire.Office contains the most up-to-date versions of the above .NET components. From Spire.Office 3.10.1, Spire.Office supports to work on .NET Core,.NET Standard, Xamarin. With Spire.Office for .NET, developers can create a wide range of applications. It enables developers to open, create, modify, convert, print, View MS Word, Excel, PowerPoint and PDF documents. Furthermore, it allows users to export data to popular files such as MS Word/Excel/RTF/Access, PowerPoint, PDF, XPS, HTML, XML, Text, CSV, DBF, Clipboard, SYLK, etc. As an independent Office .NET component, Spire.Office doesn't need Microsoft Office to be installed on neither the development nor target systems. In addition, it is a better alternative to MS Office Automation in terms of security, stability, scalability, speed, price and features. Spire.Office for .NET can be linked into any type of a 32-bit or 64-bit .NET application including ASP.NET, Web Services and WinForms for .NET Framework version 2.0 to 4.5, .NET Core, .NET standard 2.0 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
6.6.0 | 21,089 | 1/18/2024 |
6.5.7 | 3,688 | 5/23/2023 |
6.3.2 | 637 | 3/22/2023 |
6.3.1 | 244 | 3/15/2023 |
5.8.0 | 2,457 | 8/31/2022 |
5.5.0 | 5,427 | 5/6/2022 |
5.2.0 | 8,521 | 2/24/2022 |
5.1.0 | 778 | 1/10/2022 |
4.11.1 | 1,172 | 11/22/2021 |
4.7.0 | 7,421 | 7/29/2021 |
4.6.0 | 1,110 | 6/9/2021 |
4.5.0 | 795 | 5/18/2021 |
4.1.0 | 1,451 | 1/18/2021 |
3.6.7 | 13,236 | 6/9/2020 |
3.2.0 | 4,901 | 2/13/2020 |
3.1.0 | 792 | 1/3/2020 |
2.4.0 | 4,726 | 4/23/2019 |
2.1.0 | 1,405 | 1/14/2019 |
1.1.1 | 2,372 | 6/23/2017 |