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.
In today's fast-paced digital world, email communication remains an integral part of our lives. Whether it's for personal use or business interactions, having a reliable and efficient email delivery system is crucial. For iOS developers seeking a powerful and user-friendly email library, Postal stands out as a top choice. It abstracts the complexities of interacting with email servers and simplifies the process of accessing common email providers with just a few lines of Swift code. Whether users need to receive text-based emails or view attachments, the library offers a consistent and intuitive interface.
Postal is an open-source Swift library that provides software developers with a streamlined and straightforward way to fetch emails inside their iOS applications. It serves as a bridge between your app and email servers, making email integration seamless and hassle-free. The library supports various email transport options, including SMTP (Simple Mail Transfer Protocol) and API-based services like SendGrid and Mailgun. This flexibility allows software developers to choose the method that best fits their project requirements, making it a versatile solution.
Postal benefits from a thriving open-source community, ensuring that the library stays up-to-date and actively maintained. With its simplicity, flexibility, and security features, the library empowers software developers to enhance the communication experience for users, making it an excellent choice for any app that requires email integration. 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, it can handle them all. With its simple API, multiple transport options, attachment support, templating capabilities, and email tracking, "Postal" provides a comprehensive solution for all your email delivery needs.
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.