Hi,
I’m working on a ubuntu machine with the aspose.email python library.
For some emails from a pst object, the save to html function gets freezed during the execution.
It freezes in “mapi.save(html_filepath, options)” line.
Here’s my code:
def extract_folder_contents(folder, personal_storage):
final_table = [] # Initialize an empty list for each folder
# Extract messages from the folder
for message in folder.get_contents():
if 'mapi' in locals():
del mapi
try:
mapi = personal_storage.extract_message(message)
raise RuntimeError("Proxy error(InvalidOperationException): Could not read message. The message data is probably corrupted. ---> ArgumentNullException: Could not find the data block by its identifier. (Parameter 'entry')")
except:
corrupted_email.append(1)
pass
if 'mapi' in locals():
#Save the HTML original e-mails
html_filename = f"{message.entry_id_string.replace('/', '')}.html"
html_filepath = os.path.join(html_email_directory, html_filename)
options = HtmlSaveOptions()
options.html_format_options = HtmlFormatOptions.WRITE_HEADER | HtmlFormatOptions.WRITE_COMPLETE_EMAIL_ADDRESS | HtmlFormatOptions.RENDER_CALENDAR_EVENT
# Ver isto para tirar attachments do calender ? https://reference.aspose.com/email/python-net/aspose.email.mapi/mapicalendar/
try:
mapi.save(html_filepath, options)
except Exception as e:
print(f"An error occurred: {e}")
print(mapi.subject)
pass
Customer,
Carlos Pinto