Zimbra TGZ 파일 읽기 및 내보내기

Zimbra는 클라우드 기반 이메일 및 협업 스위트로, 이메일, 연락처, 캘린더, 파일 공유, 작업 및 메신저 기능을 제공하며 모든 장치에서 Zimbra 웹 클라이언트를 통해 접근할 수 있습니다.

Aspose.Email for Node.js via .NET은 개발자가 Zimbra TGZ 백업 파일에서 데이터를 읽고, 추출하며, 내보낼 수 있게 합니다. TgzReader 클래스. 모든 메시지에 쉽게 접근하고, 전체 항목 수를 세며, TGZ 파일에서 메시지, 연락처 또는 캘린더 데이터를 일반 형식으로 내보낼 수 있습니다.

Zimbra TGZ 파일에서 모든 메시지 읽기

다음은 TgzReader 클래스를 사용하면 Zimbra TGZ 백업 파일에 저장된 모든 메시지를 읽을 수 있습니다.

다음 예제는 모든 메시지를 순회하면서 폴더 위치와 제목을 표시하는 방법을 보여줍니다.

const asposeemail = require('@aspose/email');
const fs = require('fs');

// Path to the Zimbra TGZ file
const tgzPath = "ZimbraSample.tgz";

// Create a TgzReader instance
const reader = new asposeemail.TgzReader(tgzPath);

// Read and display all messages
while (reader.readNextMessage()) {
    const directoryName = reader.currentDirectory;
    console.log("Directory:", directoryName);

    const message = reader.currentMessage;
    console.log("Subject:", message.subject);
}

reader.dispose();
console.log("All messages read successfully from the Zimbra TGZ file.");

Zimbra TGZ 파일의 전체 항목 수 세기

TGZ 백업에 포함된 이메일 항목 수를 빠르게 확인하려면 다음을 사용하십시오: getTotalItemsCount() 메서드 TgzReader 클래스.

다음 코드 샘플은 프로젝트에서 이 메서드를 구현하는 방법을 보여줍니다:

const asposeemail = require('@aspose/email');

const tgzFile = "ZimbraSample.tgz";
const reader = new asposeemail.TgzReader(tgzFile);

const totalCount = reader.getTotalItemsCount();
console.log(`Total items in TGZ file: ${totalCount}`);

reader.dispose();

Zimbra TGZ 파일에서 메시지 및 폴더 구조 저장

다음은 exportTo() 이 메서드는 원래 폴더 구조를 유지하면서 TGZ 파일의 모든 메시지를 저장할 수 있게 합니다. 이는 사서함 데이터를 복원하거나 마이그레이션할 때 유용합니다.

다음 코드 샘플은 Aspose.Email 라이브러리를 사용해 TGZ 아카이브 파일에서 모든 Zimbra 이메일 메시지를 추출하고 내보내는 방법을 보여줍니다.

const asposeemail = require('@aspose/email');

const tgzFile = "ZimbraSample.tgz";
const outputDir = "Output/Zimbra/";

const reader = new asposeemail.TgzReader(tgzFile);
reader.exportTo(outputDir);

reader.dispose();
console.log(`All Zimbra messages exported to: ${outputDir}`);

Zimbra 백업 파일에서 캘린더 및 연락처 내보내기

Zimbra TGZ 백업에는 연락처 및 캘린더 폴더가 포함될 수 있습니다. 동일한 방법을 사용해 이를 VCard(.vcf) 및 iCalendar(.ics) 형식으로 내보낼 수 있습니다. exportTo() 메서드.

const asposeemail = require('@aspose/email');

const tgzFile = "ZimbraBackup.tgz";
const outputPath = "Output/ZimbraData/";

const reader = new asposeemail.TgzReader(tgzFile);

// Contacts can be found in "Contacts" and "Emailed Contacts" folders.
// Calendar entries can be found in the "Calendar" folder.
reader.exportTo(outputPath);

reader.dispose();
console.log("Zimbra calendar and contacts exported successfully.");