SwiftyEmail - A super simple Swift e-mail composer package

Overview

Swift Version Dependency frameworks Twitter

SwiftyEmail is a mini library for iOS, iPadOS and Mac Catalyst using MessageUI. With SwiftyEmail, you'll be able to send e-mails from your app calling your user's favorite e-mail app (including third party ones!).

Features

  • Send E-mails: Easily send e-mails from your app by calling the correct e-mail app.
  • Third-Party Apps: Send e-mails with Gmail, Yahoo Mail, Spark or Outlook. We've got you covered with Mail, also!
  • Simple: Just call a single method and you're done.
  • Built Swifty and with lightweight in mind.
  • 100% Swift.
  • Documented.

🚀 Get Started

Using SwiftyEmail in Production Code

Just import SwiftyEmail:

import SwiftyEmail

Add the LSApplicationQueriesSchemes key to your Info.plist. It's an array with four strings.

<key>LSApplicationQueriesSchemeskey>
<array>
	<string>googlegmailstring>
	<string>ms-outlookstring>
	<string>readdle-sparkstring>
	<string>ymailstring>
array>

It should look like this:

Okay! 🚀 Now, you can use it as you please. Use it like this:

SwiftyEmail.shared.sendEmail(subject: "Your order has been processed!",
                             body: "This is just an example for an e-mail body.",
                             recipient: "[email protected]") { result in
    switch result {
    case .success(let emailWasSent):
        print("The viewController was presented and the email \(emailWasSent)")
    case .failure(let error):
        print(error.localizedDescription)
    }
}

Then, the user's e-mail app is going to be called if the result is a success, with all the data provided.

Always remember that the e-mail has a subject, a body and a recipient, as well as the result for presenting the e-mail app.

🔨 Swift Package Manager

You can also add this library using Swift Package Manager.

  1. Go to File > Add Packages.
  2. The Add Package dialog will appear, by default with Apple packages.
  3. In the upper right hand corner, paste https://github.com/MarcosAtMorais/SwiftyEmail into the search bar.
  4. Hit Return to kick off the search.
  5. Click Add Package.
  6. You're all set! Just import SwiftyEmail whenever and wherever you want to use it.

🌟 Requirements

iOS 13+

iPadOS 13+

Mac Catalyst 13+

You might also like...
An easy-to-use UITableViewCell subclass that implements a swippable content view which exposes utility buttons (similar to iOS 7 Mail Application)
An easy-to-use UITableViewCell subclass that implements a swippable content view which exposes utility buttons (similar to iOS 7 Mail Application)

SWTableViewCell An easy-to-use UITableViewCell subclass that implements a swipeable content view which exposes utility buttons (similar to iOS 7 Mail

A super simple tool for macOS Swift developers to check validity of a Gumroad-issued software license keys

Gumroad License Validator Overview A super simple tool for macOS Swift developers to check validity of a Gumroad-issued software license keys Requirem

Swift Package Manager plugin which runs ActionBuilder to create a Github Actions workflow for a swift package.

ActionBuilderPlugin A Swift Package Manager command which builds a Github Actions workflow for the current package. By default the workflow file will

Super Simple Pager with RxSwift extension

SSPager Super Simple Pager Example To run the example project, clone the repo, and run pod install from the SSPagerExample directory first. Installati

A super simple retina (2x, 3x) image converter.
A super simple retina (2x, 3x) image converter.

Retini A super fast and simple retina (@2x, @3x) image converter. How to use? You can download the prebuilt application from the releases, or just dow

A super simple library for state management with unidirectional data flow.
A super simple library for state management with unidirectional data flow.

OneWay 🚧 OneWay is still experimental. As such, expect things to break and change in the coming months. OneWay is a super simple library for state ma

Swift Package used for video where I demonstrate how to extract a package to a local framework and modify it.
Swift Package used for video where I demonstrate how to extract a package to a local framework and modify it.

SegmentedPicker NOTE: This sample code is taken from the article by Frank Jia in his article titled Build a Custom iOS Segmented Control With SwiftUI

This package is meant to make http request of an easy way inspiren in the architecture of Moya package

NetworkAgent This package is meant to make http request of an easy way inspiren in the architecture of Moya package. This package is 100% free of depe

Super awesome Swift minion for Core Data (iOS, macOS, tvOS)

⚠️ Since this repository is going to be archived soon, I suggest migrating to NSPersistentContainer instead (available since iOS 10). For other conven

Super lightweight DB written in Swift.
Super lightweight DB written in Swift.

Use of value types is recommended and we define standard values, simple structured data, application state and etc. as struct or enum. Pencil makes us store these values more easily.

Super lightweight web framework in Swift based on SWSGI

Ambassador Super lightweight web framework in Swift based on SWSGI Features Super lightweight Easy to use, designed for UI automatic testing API mocki

Super lightweight async HTTP server library in pure Swift runs in iOS / MacOS / Linux

Embassy Super lightweight async HTTP server in pure Swift. Please read: Embedded web server for iOS UI testing. See also: Our lightweight web framewor

Super awesome Swift minion for Core Data (iOS, macOS, tvOS)

⚠️ Since this repository is going to be archived soon, I suggest migrating to NSPersistentContainer instead (available since iOS 10). For other conven

Extensions giving Swift's Codable API type inference super powers 🦸‍♂️🦹‍♀️
Extensions giving Swift's Codable API type inference super powers 🦸‍♂️🦹‍♀️

Welcome to Codextended — a suite of extensions that aims to make Swift’s Codable API easier to use by giving it type inference-powered capabilities an

✨ Super sweet syntactic sugar for Swift initializers

Then ✨ Super sweet syntactic sugar for Swift initializers. At a Glance Initialize UILabel then set its properties. let label = UILabel().then { $0.t

Super lightweight async HTTP server library in pure Swift runs in iOS / MacOS / Linux

Embassy Super lightweight async HTTP server in pure Swift. Please read: Embedded web server for iOS UI testing. See also: Our lightweight web framewor

Super lightweight web framework in Swift based on SWSGI

Ambassador Super lightweight web framework in Swift based on SWSGI Features Super lightweight Easy to use, designed for UI automatic testing API mocki

Super lightweight DB written in Swift.
Super lightweight DB written in Swift.

Use of value types is recommended and we define standard values, simple structured data, application state and etc. as struct or enum. Pencil makes us

Super lightweight async HTTP server library in pure Swift runs in iOS / MacOS / Linux

Embassy Super lightweight async HTTP server in pure Swift. Please read: Embedded web server for iOS UI testing. See also: Our lightweight web framewor

Owner
Marcos Morais
Game Developer. App Developer. Former Mentor at the Apple Developer Academy.
Marcos Morais
SwiftUIMailView - MailView allows you to send mail from SwiftUI

SwiftUIMailView The MailView allows you to send mail from SwiftUI. You can: Determine if you can send mail or not. Pass subject, message and recipient

Gordan Glavaš 13 Nov 24, 2022
TempBox - Instant disposable emails for Mac powered by Mail.tm

TempBox Instant disposable emails for Mac powered by Mail.tm Features Native Mac app Create multiple accounts Download message source Download Attachm

Waseem akram 217 Dec 30, 2022
Postal is a swift framework providing simple access to common email providers.

Postal is a swift framework providing simple access to common email providers. Example Connect let postal = Postal(configuration: .icloud(login: "myem

Snips 644 Dec 23, 2022
ProtonMail for macOS - Experimental email client for the ProtonMail service written in Swift

ProtonMail for macOS Experimental email client for the ProtonMail service written in Swift. About A pet project, largely incomplete and missing major

Marcel Piestansky 33 Jan 2, 2023
MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP.

MailCore 2: Introduction MailCore 2 provides a simple and asynchronous Objective-C API to work with the e-mail protocols IMAP, POP and SMTP. The API h

MailCore 2.5k Jan 1, 2023
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift.

SwipeCellKit Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. About A swipeable UITableViewCell or UI

null 6k Jan 7, 2023
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.

SPStorkController About Controller as in Apple Music, Podcasts and Mail apps. Help if you need customize height or suppport modal style in iOS 12. Sim

Ivan Vorobei 2.6k Jan 4, 2023
SwiftUIMailView - MailView allows you to send mail from SwiftUI

SwiftUIMailView The MailView allows you to send mail from SwiftUI. You can: Determine if you can send mail or not. Pass subject, message and recipient

Gordan Glavaš 13 Nov 24, 2022
iOS-mail — ProtonMail iOS client app

iOS-mail Introduction iOS-mail — ProtonMail iOS client app The app is intended for all users of the ProtonMail service. Whether they are paid or free,

null 1.2k Jan 3, 2023
TempBox - Instant disposable emails for Mac powered by Mail.tm

TempBox Instant disposable emails for Mac powered by Mail.tm Features Native Mac app Create multiple accounts Download message source Download Attachm

Waseem akram 217 Dec 30, 2022