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;

What is Aspose.Email for Python via .NET?

In today’s busy online world, handling emails efficiently is crucial for both businesses and individuals. Whether you’re streamlining responses, gathering important data, or sorting through your messages, having strong tools to handle emails can really boost your productivity. That’s whereAspose.Email for Python via .NET steps in as a real game-changer, providing a smooth solution for managing all your email tasks. A great thing about the library is how flexible it is when it comes to handling different types of emails. Whether you’re working with Outlook messages (MSG), PST files, or MIME messages, this library offers a lot of help in reading, writing, and managing emails.

Aspose.Email for Python via .NET is a powerful tool for developers working on Python applications. It offers a wide range of features for managing emails efficiently. By combining the capabilities of the .NET framework, this tool provides developers with various functions to handle emails smoothly. It also makes sending and receiving emails through code much easier. With support for SMTP and POP3 clients built-in, you can easily incorporate email communication features into your applications. This not only saves time but also ensures reliable email delivery and retrieval, essential for mission-critical applications.

One more great thing about Aspose.Email for Python through .NET is how it simplifies email tasks. If you’re a software developer, you can smoothly pull out attachments, insert images, or change emails to other formats using only a few lines of code. This library is also fantastic at converting emails, making it a breeze to switch between different email formats. Whether you need to turn emails into PDFs for safekeeping or export them to HTML for online viewing, it’s got you covered. With its rich feature set, seamless integration, and robust performance, Aspose.Email empowers developers to unlock new possibilities in email automation, data extraction, and communication workflows.

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")
client.send(eml)

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("\n\nheaders:\n\n")
# 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()
attendees.append("attendee@domain.com")
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)
writer.write(app)

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;
try
{
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.");
} 
 English