เริ่มต้นใช้งาน

เริ่มต้นใช้งาน Aspose.Email FOSS สำหรับ .NET

ยินดีต้อนรับสู่ Aspose.Email FOSS for .NET, ไลบรารี C# ฟรีที่มีใบอนุญาต MIT สำหรับการอ่าน, สร้าง และเขียนไฟล์ Outlook MSG, คอนเทนเนอร์ Compound File Binary (CFB) และ EML ข้อความ. คู่มือฉบับนี้พาคุณจากโครงการ .NET ใหม่ไปสู่การทำงานกับไฟล์ MSG ภายในไม่กี่นาที.


ข้อกำหนดเบื้องต้น

ข้อกำหนดรายละเอียด
.NET8.0 หรือใหม่กว่า
ตัวจัดการแพคเกจNuGet (dotnet CLI หรือ Visual Studio)
ระบบปฏิบัติการWindows, macOS หรือ Linux
การพึ่งพาไม่มี — pure managed C#

การติดตั้ง

ติดตั้งจาก NuGet:

dotnet add package Aspose.Email.Foss

ตรวจสอบในแอปคอนโซลขนาดเล็ก:

using Aspose.Email.Foss.Msg;

var message = MapiMessage.Create("Test", "Hello");
Console.WriteLine($"Subject: {message.Subject}");
// Output: Subject: Test

ดู คู่มือการติดตั้ง สำหรับรายละเอียดการตั้งค่าโครงการ.


สิ่งที่คุณทำได้

เมื่อติดตั้งแล้วคุณสามารถทำได้ทันที:

  • อ่าน MSG files with MapiMessage.FromStream() or MapiMessage.FromFile() — access subject, body, HTML body, sender, recipients, and attachments
  • สร้าง MSG messages from scratch with MapiMessage.Create() — set all fields, add recipients and attachments, then serialize with message.Save()
  • แปลง between MSG and EML (MIME/RFC 5322) with LoadFromEml() and SaveToEml()
  • ตรวจสอบ the underlying CFB binary container with CfbReader — traverse storages and streams, resolve paths, read raw bytes
  • เขียน CFB documents with CfbWriter for forensic inspection or format construction
  • จัดการไฟล์แนบ — add file, stream, or embedded MSG attachments with full metadata

เริ่มต้นอย่างรวดเร็ว

อ่านไฟล์ MSG และพิมพ์หัวเรื่องและผู้รับ:

using System.IO;
using Aspose.Email.Foss.Msg;

using var stream = File.OpenRead("sample.msg");
var message = MapiMessage.FromStream(stream);

Console.WriteLine($"Subject: {message.Subject}");
Console.WriteLine($"From: {message.SenderEmailAddress}");

foreach (var recipient in message.Recipients)
    Console.WriteLine($"To: {recipient.EmailAddress}");

foreach (var attachment in message.Attachments)
    Console.WriteLine($"Attachment: {attachment.Filename} ({attachment.MimeType})");

ขั้นตอนต่อไป

  • Installation Guide: รายละเอียดการตั้งค่าโครงการและการติดตั้ง NuGet
  • Developer Guide: การดำเนินการ MSG, ไฟล์แนบ, คุณสมบัติ MAPI, และโครงสร้าง CFB
  • Features: การสำรวจเชิงลึกทุกฟีเจอร์พร้อมตัวอย่าง C#
 ภาษาไทย