MBOX를 PST로 변환
Contents
[
Hide
]
MBOX를 PST로 변환. 기본 변환
Mozilla Thunderbird와 같은 클라이언트에서 Microsoft Outlook으로 메일 데이터를 마이그레이션할 때 MBOX 아카이브를 PST(개인 저장소 테이블) 형식으로 변환해야 하는 경우가 많습니다. PST 형식은 Outlook 및 Exchange의 고유 형식이며 폴더 구조와 MAPI 기반 메시지 처리를 지원합니다.
Aspose.Email을 사용하면 MBOX 파일에서 Outlook 호환 스토리지로 메시지를 전송하면서 변환 프로세스를 완전히 제어할 수 있습니다. 아래 예제는 MBOX 아카이브에서 메시지를 로드하고 구조화된 Outlook 데이터 파일에 저장합니다:
- 다음으로 MBOX 리더를 초기화합니다 MboxStorageReader.create_reader().
- PST 파일을 생성합니다 PersonalStorage.create().
- 메일 폴더를 추가합니다 — 예: "Inbox" — 저장소에.
- 메시지를 순회하면서 각각을 MapiMessage 그리고 폴더에 삽입합니다.
from aspose.email.mapi import MapiMessage
from aspose.email.storage.mbox import MboxStorageReader, MboxLoadOptions
from aspose.email.storage.pst import PersonalStorage, FileFormatVersion, StandardIpmFolder
# Load the source file
mbox = MboxStorageReader.create_reader("source.mbox", MboxLoadOptions())
# Create the destination Outlook data file
with PersonalStorage.create("converted.pst", FileFormatVersion.UNICODE) as personal_storage:
# Add a folder to hold the imported messages
folder_info = personal_storage.create_predefined_folder("Inbox", StandardIpmFolder.INBOX)
# Process each message from the source file
for eml in mbox.enumerate_messages():
msg = MapiMessage.from_mail_message(eml)
folder_info.add_message(msg)
서명을 유지하거나 제거하면서 MBOX를 PST로 변환
MBOX 파일을 PST 형식으로 변환할 때, 보다 깔끔한 출력이나 호환성을 위해 메시지의 디지털 서명을 제외하고 싶을 수 있습니다. Aspose.Email은 변환 과정에서 이러한 서명을 제거하는 편리한 옵션을 제공합니다: remove_signature 속성 MboxToPstConversionOptions 클래스.
아래 예제는 Python 프로젝트에서 이 옵션을 활성화하는 방법을 보여줍니다:
import aspose.email as ae
personalStorage = ae.storage.pst.PersonalStorage.create("target.pst", ae.storage.pst.FileFormatVersion.UNICODE)
conversion_options = ae.storage.MboxToPstConversionOptions()
conversion_options.remove_signature = True
ae.storage.MailStorageConverter.mbox_to_pst( ae.storage.mbox.MboxrdStorageReader("source.mbox", ae.storage.mbox.MboxLoadOptions()), personalStorage, "Inbox", conversion_options)