Free Swift Library to Fetch Emails From Common Email Providers
Open Source Swift API that allows Software Developers to Fetch, Receive, Track and Manage emails from Gmail, Outlook, Yahoo, or custom SMTP servers.
What is Postal Library?
Email communication is still a vital aspect of our lives in the fast-paced digital world of today. It is essential to have a dependable and effective email delivery system for both personal and professional use. Postal is a great option for iOS developers looking for a robust and intuitive email framework. With just a few lines of Swift code, it streamlines the process of gaining access to popular email providers and abstracts away the difficulties of communicating with email servers. The library provides a dependable and user-friendly interface for users that need to view files or receive text-based emails.
An open-source Swift package called Postal gives programmers a simple and efficient method for retrieving emails within their iOS apps. It facilitates easy and smooth email integration by acting as a link between your app and email servers. Email transport methods supported by the library include SMTP (Simple Mail Transfer Protocol) and API-based services such as Mailgun and SendGrid. It is a flexible solution that enables software developers to select the approach that best suits the needs of their project.
Postal enjoys the advantages of a vibrant open-source community, which keeps the library current and maintained. The library is a great option for any app that needs email integration because of its ease of use, adaptability, and security features, which enable software developers to improve user communication. The library provides flexibility for both developers and users by supporting a number of email service providers. Your application is capable of supporting custom SMTP servers, Gmail, Outlook, and Yahoo. "Postal" offers a comprehensive solution for all of your email delivery requirements with its easy-to-use API, numerous transport options, attachment support, templating capabilities, and email tracking.
Getting Started with Postal
The recommended way to install Postal is via CocoaPods, please use the following command for easy installation.
Install Postal via CocoaPods
// add the followings to your Podfile
use_frameworks!
pod 'Postal'
Run pod install.
Multiple Services Support via Swift API
The open source Postal library enables software developers to effortlessly incorporate email functionality into their iOS and macOS applications. The library offers support for various email service providers, ensuring flexibility for developers and users alike. Whether your app uses Gmail, Outlook, Yahoo, or custom SMTP servers, Postal can handle them all with ease. The library handles all the low-level IMAP connection and parsing in a synchronous way. The following example shows how to connect with an email provider inside Swift applications.
How to Connect with an Email Provider inside Swift Apps?
let postal = Postal(configuration: .icloud(login: "myemail@icloud.com", password: "mypassword"))
postal.connect { result in
switch result {
case .success:
print("success")
case .failure(let error):
print("error: \(error)")
}
}
Fetch & Display Email Message inside Swift Apps
The open source Postal library has provided complete support for fetching and displaying email messages contents inside their Swift applications. It has included numerous functions for handling email messages such as compose emails with rich text, viewing message with HTML support, tracking an email message, fetching inline images, viewing messages from multiple users and many more. The following example shows how to fetch email messages with just a couple of lines of Swift code.
How to Fetch Email Messages via Swift API?
let indexset = NSIndexSet(index: 42)
postal.fetchMessages("INBOX", uids: indexset, flags: [ .headers ], onMessage: { email in
print("new email received: \(email)")
}, onComplete: error in
if error = error {
print("an error occured: \(error)")
}
Manage Email Attachment via Swift API
Sending and receiving files via email is a common requirement in many applications. The open source Postal simplifies the process of handling email attachments, images, and other content inside email messages, enhancing the overall user experience. Whether it's a PDF, image, or any other file type, you can effortlessly fetch and view attachments inside your email messages with just a couple of lines of code.