1. Products
  2.   Email
  3.   Python
  4.   Aspose.Email for Python via .NET

Aspose.Email for Python via .NET


Python API to Process Microsoft Outlook Emails

A Powerful Python Email Processing API that allows Adding Appointments, Extracting Email Contents as well as Creating, Editing and Converting Email Messages;

Aspose.Cells Cloud SDK for Go is a powerful and reliable cloud-based solution that allows software developers to work with Excel files in the cloud. One of the main benefits of using the Aspose.Cells Cloud SDK for Go is that it is cloud-based. This means that you can easily access your Excel files from anywhere and on any device. So users don't need to install any software or worry about file compatibility issues and everything is safely handled in the cloud. The SDK can be used to develop software applications for a wide range of operating systems, such as Windows, Linux, Mac OS, and many others.

Aspose.Cells Cloud SDK for Go has included a rich set of features that can help software developers in automating many Excel-related tasks, such as performing complex calculations, formatting cells, adding charts, and much more. It is very easy to handle and has provided support for some popular Microsoft Excel file formats such as XLS, XLSX, XLSB, XLSM, XLT, XLTX, XLTM, ODS, XML, CSV, TSV, TXT (TabDelimited), HTML, MHTML, DIF, PDF, XPS, TIFF, SVG, SXC, FODS and many more. Using Aspose.Cells Cloud SDK software developers can protect their Excel files with a password as well as unprotected files that have been password protected.

Aspose.Cells Cloud SDK for Go is very easy to handle and has included several advanced features enabling software developers to manipulate Microsoft Excel spreadsheets, such as applying auto filtering, pivot tables handling, managing conditional formatting, converting ListObject or table to a range of cells, manage rows and cells, search and replace text in Excel Worksheet, adding a background in the workbook, inserting shape on a worksheet, add a pivot table on an Excel worksheet, hide rows on an Excel worksheet, auto-fit columns on the workbook and many more.

Previous Next

Getting Started with Aspose.Email for Python via .NET

The recommend way to install Aspose.Email for Python via .NET is using Pypi. Please use the following command for a smooth installation.

Install Aspose.Email for Python via .NET via Pypi

pip install Aspose.Email-for-Python-via-NET 
You can also download it directly from Aspose product page.

Create & Send Email Messages via Python API

Aspose.Email for Python via .NET makes it easy for software developers to create new email messages from the scratch with all basic email properties like From, To, Subject and body can be easily attached with the newly created mail message. The library has included several important features for handling email messages, such as creatig a new email with different properties, sending email messages to multiple recipients, request a read receipt, changing email addresses to a friendly name, setting Mail Body, setting HTML body, get or set an email’s date and time and many more.

Use multiple To, CC and BCC Addresses While Sending Email Messages via Python

eml = ae.MailMessage()
eml.subject = "New MailMessage created with Aspose.Email for Python"
eml.html_body = "This line is in bold  while this is normal text"
eml.from_address = "kashif.iqbal.aspose@domain.com"
eml.to.append(ae.MailAddress("to1@domain.com", "Recipient 1"))
eml.to.append(ae.MailAddress("to2@domain.com", "Recipient 2"))
eml.cc.append(ae.MailAddress("cc1@domain.com", "Recipient 3"))
eml.cc.append(ae.MailAddress("cc2@domain.com", "Recipient 4"))
# Send using Smtp Client
client = SmtpClient("smtp.gmail.com", 587, "username", "password")

Extract Email Message Contents via Python API

Aspose.Email for Python via .NET has provided support for extracting email messages contents from the emails inside Python applications. Software developers can easily display selected email messages contents on the screen with just couple of lines of Python code. The library has also provided support that allows software developers to extract email headers as well as decoded header values and uses it according to their own needs. The following example shows how to extract email headers and display it on the screen inside Python applications.

How to Extract Email Headers via Python API

# Create MailMessage instance by loading an EML file
message = MailMessage.load(dataDir + "email-headers.eml");
# Print out all the headers
index = 0
for index, header in enumerate(message.headers):
print(header + " - ", end=" ")
print (message.headers.get(index))

Create & Manage Appointment inside Python Apps

Aspose.Email for Python via .NET is a very useful library for working with Outlook appointments. The library enables software developers to create new appointments and save it in ICS file format. You can set various properties for your appointment, such as Start Date, End Date, description, organizer, location, summary, and so on. You can easily open the appointment file in Microsoft Outlook or any program that can load an ICS file which will add the appointment information in the Outlook calendar. The library also supports loading an existing appointment in ICS format, reading and writing multiple events from ICS file, set status of appointment attendees and so on.

How to Write Multiple Events to ICS File via Python API

saveOptions = IcsSaveOptions()

saveOptions.action = AppointmentAction.CREATE
writer = CalendarWriter(dataDir + "WriteMultipleEventsToICS_out.ics", saveOptions)
attendees = MailAddressCollection()
for i in range(10):
app = Appointment("Room 112", dt.datetime(2018, 5, 27, 22, 12, 11), dt.date(2018, 5, 28), "from@domain.com", attendees)
app.description = "Test body " + str(i)
app.summary = "Test summary:" + str(i)

Manage Outlook Storage Files (OST, PST) via Python

Aspose.Email for Python via .NET gives software developers the power to create and manage Outlook Storage Files (OST, PST) inside their own Python applications. There are many useful features available in the library for working with OST or PST files, such as creating new PST file and add subFolders to it, searching for messages, reading and Converting Outlook OST File, splitting and merging PST files, manage calendar items & contacts inside PST file, working with messages in a PST file, opening and reading Outlook PST File, get folders and fubFolders Information from PST and many more. The following example demonstrates how to merge into a single PST via Python API, 

How to Merge Multiple PSTs into a Single PST via Python API

string dataDir = RunExamples.GetDataDir_Outlook();
string dst = dataDir + "Sub.pst";
totalAdded = 0;
using (PersonalStorage personalStorage = PersonalStorage.FromFile(dst))
// The events subscription is an optional step for the tracking process only.
personalStorage.StorageProcessed += PstMerge_OnStorageProcessed;
personalStorage.ItemMoved += PstMerge_OnItemMoved;
// Merges with the pst files that are located in separate folder. 
personalStorage.MergeWith(Directory.GetFiles(dataDir + @"MergePST\"));
Console.WriteLine("Total messages added: {0}", totalAdded);
Console.WriteLine(Environment.NewLine + "PST merged successfully at " + dst);
catch (Exception ex)
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose Email License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");