1. Ürünler
  2.   Aspose.Email
  3.   Aspose.Email FOSS for Python

Python için Aspose.Email FOSS

Python’dan Outlook MSG dosyalarını okuyun, oluşturun ve yazın — ücretsiz ve açık kaynak, Microsoft Office gerekmez.

Outlook MSG Dosyaları için Açık Kaynaklı Python Kütüphanesi

Aspose.Email FOSS for Python, %100 ücretsiz, MIT lisanslı bir kütüphanedir ve Microsoft Outlook MSG dosyalarını tamamen Python’dan okuyup yazmanıza olanak tanır; Microsoft Office, COM otomasyonu ve özel bir çalışma zamanı gerektirmez. MAPI kavramlarına (MapiMessage, MapiAttachment, MapiRecipient) dayanan temiz bir genel API sunar ve saf Python’da yazılmış yerleşik bir CFB (Compound File Binary) ayrıştırıcı tarafından desteklenir.

pip install aspose-email-foss komutuyla PyPI’den kurun. Python 3.10 veya daha yeni bir sürüm gerektirir.

Bu kütüphane, e‑posta arşivleme betikleri, uyumluluk boru hatları, geçiş araçları ve Microsoft Office bağımlılığı olmadan Outlook MSG dosyalarını ayrıştırması veya üretmesi gereken herhangi bir sunucu‑tarafı iş akışı için uygundur.

Read and Write MSG Files

  • Load MSG files: Open any Outlook MSG file with MapiMessage.from_file().
  • Access message data: Read subject, body, HTML body, message class, and transport headers.
  • Iterate attachments: Walk attachment metadata with iter_attachments_info() or access binary data.
  • Create messages: Build new MSG files from scratch with MapiMessage.create().
  • Save MSG files: Write to disk with save() or get bytes with to_bytes().

Where Aspose.Email FOSS Can Be Used

  • Email archival: Parse and index MSG files for compliance and retention workflows.
  • Migration tools: Convert MSG files to RFC 5322 email format for cross-platform migration.
  • Automation scripts: Generate MSG files programmatically for notification systems.
  • CI/CD pipelines: Validate MSG file structure inside Docker containers.
  • Forensic analysis: Inspect low-level CFB structure and MAPI properties.

Recipients, Attachments, and Properties

  • Add recipients: Attach To, CC, and BCC recipients with display names and email addresses.
  • File attachments: Add binary file attachments with MIME types.
  • Embedded messages: Nest MSG files inside other MSG files as embedded message attachments.
  • MAPI properties: Read and write any MAPI property by property ID or named property.
  • Email conversion: Convert between MSG and RFC 5322 email format with to_email_message() and from_email_message().

Developer Experience

Aspose.Email FOSS installs with a single pip install aspose-email-foss command. The package has zero external dependencies and is pure Python.

The API follows MAPI conventions: MapiMessage, MapiAttachment, MapiRecipient, MapiProperty. The library is MIT-licensed, open-source, and accepts bug reports and contributions on GitHub.

Load an MSG File and Read Its Properties

Install with pip, then pass a file path to MapiMessage.from_file() to parse the MSG binary format. Access subject, body, and attachments through the high-level API.

pip install aspose-email-foss
from aspose.email_foss.msg import MapiMessage

msg = MapiMessage.from_file("message.msg")
print(f"Subject: {msg.subject}")
print(f"Body: {msg.body}")

for att in msg.iter_attachments_info():
    print(f"Attachment: {att.storage_name}")

Create a New MSG File with Attachments

Create MSG files from scratch, add recipients and attachments, and save to disk.

from aspose.email_foss.msg import MapiMessage

msg = MapiMessage.create("Meeting Notes", "Please review attached.")
msg.add_recipient("alice@example.com", display_name="Alice")

with open("notes.pdf", "rb") as f:
    msg.add_attachment("notes.pdf", f.read(), mime_type="application/pdf")

msg.save("output.msg")

Sıkça Sorulan Sorular

What is Aspose.Email FOSS for Python?

It is a free, MIT-licensed Python library for reading and writing Microsoft Outlook MSG files without requiring Microsoft Office, COM automation, or any proprietary runtime.

Which email formats are supported?

MSG (Outlook) files in CFB v3 and v4 format. The library can also convert between MSG and RFC 5322 email format.

How do I install it?

Run pip install aspose-email-foss. Requires Python 3.10 or later.

Can I read EML files?

Not directly. Use MapiMessage.from_email_message() to convert from an EmailMessage object constructed from EML content.

Can I create MSG files from scratch?

Yes. Use MapiMessage.create(subject, body) to build a new message, then add recipients and attachments before saving.

Is thread-safety supported?

Each MapiMessage instance is independent. Concurrent operations on separate instances are safe.

Where can I find the source code?

The library is MIT-licensed and hosted on GitHub at aspose-email-foss/Aspose.Email-FOSS-for-Python.

  

Destek ve Öğrenme Kaynakları

 Türkçe