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;
In today's fast-paced digital world, efficient email handling is essential for businesses and individuals alike. Whether it's automating responses, extracting valuable data, or organizing communication streams, having robust tools to manage emails can significantly enhance productivity. Aspose.Email for Python via .NET emerges as a game-changer, offering a seamless solution for email processing tasks. One of the standout features of the library is its versatility in working with various email formats. Whether dealing with Outlook messages (MSG), PST files, or MIME messages, the library provides extensive support for parsing, creating, and manipulating emails
Aspose.Email for Python via .NET is a comprehensive library designed to empower software developers with advanced email management capabilities within Python applications. Leveraging the strength of .NET framework, this integration opens up a plethora of functionalities to handle emails effortlessly. Furthermore, it simplifies the process of sending and receiving emails programmatically. With built-in SMTP and POP3 client support, developers can seamlessly integrate email communication functionalities into their applications. This not only saves time but also ensures reliable email delivery and retrieval, essential for mission-critical applications.
Another compelling aspect of Aspose.Email for Python via .NET is its ability to streamline email extraction and manipulation tasks. Software developers can easily extract attachments, embed images, or even convert emails to different formats with just a few lines of code. The library also excels in email conversion tasks, allowing seamless conversion between various email formats. Whether converting emails to PDF for archival purposes or exporting them to HTML for web display. 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.
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.");
}