Unable to extract mail body text and bcc from PST file

Hi Team,
I am building a tool using Aspose Email for python via .net.
I am unable to find a method that can extract mail body in plain text and bcc data.
Could someone please help me out with this?

Thanks…

@spidy007,
Welcome to our community! Thank you for the query. You can extract the mail body as the plain text and Bcc data from messages in a PST file as below:

PersonalStorage personalStorage = PersonalStorage.FromFile(pstFilePath);
FolderInfo folderInfo = personalStorage.RootFolder.GetSubFolder("Inbox");

MessageInfoCollection messageInfoCollection = folderInfo.GetContents();
foreach (MessageInfo messageInfo in messageInfoCollection)
{
    Console.WriteLine("======================= next message =======================");
    Console.WriteLine("Subject: " + messageInfo.Subject);

    MapiMessage mapiMessage = personalStorage.ExtractMessage(messageInfo);

    MailConversionOptions options = new MailConversionOptions(); // set your options
    MailMessage mailMessage = mapiMessage.ToMailMessage(options);

    Console.WriteLine("Bcc: " + mailMessage.Bcc);
    Console.WriteLine("Plain text:\r\n" + mailMessage.Body);
}

More examples: Working with Messages in a PST File
API Reference: PersonalStorage Class, MapiMessage Class, MailMessage Class

Hi Andrey
Thanks for replying. Found a way to get them on both Java and C++. However, I am unable to find the same for python. Could you please help here?

@spidy007,
Please take a look at the next code snippet for Python:

        messageInfoCollection = folderInfo.get_contents()

        for messageInfo in messageInfoCollection:
                print ("Subject: " + messageInfo.subject)

Documents: Aspose.Email for Python via .NET
Library: Python Email Library
Examples: Aspose.Email-Python-Dotnet / Examples

I searched whole of their repository on GitHub. Nothing seems to work. Currently, im able to extract sender name, recipient, subject, cc. In addition to these, I need to extract body, bcc and mail time in python which I am unable to.

Thanks…

@spidy007,
It will take me a while to find out this information. I will answer you as soon as possible.

@spidy007,
I added a ticket to our tracking system with ID EMAILNET-40248. Our development team will prepare a code example for you.

Great!!

Thanks for the help!!

Hi @Andrey_Potapov ,
Could you please check if there is any updates on this?

Thanks!

@spidy007,
I requested the code example from our development team for you. I will answer as soon as possible.

A post was split to a new topic: Extract body, to, from the .pst files using python