קרא וייצא קבצי Zimbra TGZ

Zimbra הוא חבילה מבוססת ענן למייל ושיתוף פעולה המספקת דוא"ל, אנשי קשר, לוחות שנה, שיתוף קבצים, משימות והודעות - כולם נגישים דרך לקוח האינטרנט של Zimbra בכל מכשיר.

Aspose.Email ל‑Node.js דרך .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 תוך שמירה על מבנה התיקיות המקורי. זה שימושי בעת שחזור או העברת נתוני תיבת דואר.

קטע הקוד הבא מדגים כיצד לחלץ ולייצא את כל הודעות האימייל של Zimbra מקובץ ארכיון TGZ באמצעות ספריית Aspose.Email.

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.");