/Maily

Send email to third-party mail clients easily

Primary LanguageSwiftMIT LicenseMIT

Build Status PRs Welcome

Maily

Send email to third-party mail clients easy.

Supported clients

Client URL Scheme
Gmail googlegmail
Dispatch x-dispatch
Spark readdle-spark
Airmail airmail
Microsoft Outlook ms-outlook
Yahoo Mail ymail

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Maily into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'Maily', '~> 1.0.0'

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding Maily as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/ismetanin/Maily.git", .upToNextMajor(from: "1.0.0"))
]

Usage

Before start you are required to add all needed schemes to your LSApplicationQueriesSchemes in the Info.plist file. Without this step you won't be able to find third party clients.

Code to drop into Info.plist
 <key>LSApplicationQueriesSchemes</key>
 <array>
     <string>ymail</string>
     <string>ms-outlook</string>
     <string>airmail</string>
     <string>readdle-spark</string>
     <string>x-dispatch</string>
     <string>googlegmail</string>
 </array>

Present dialog to send email to available clients

Maily.shared.sendMail(recipient: "", subject: "", body: "", presentHandler: {}, cancelHandler: {})

Before this action you would probably like to check client's availability. For this you may call

Maily.shared.canSendMail

To access an available client just use

Maily.shared.clients

Localization

To localize action sheet "Cancel" button just change cancelButtonTitle property in Maily.shared.

Customization

Almost every class, property, and method is open so you can just subclass or build Facade over them.

To add a new third party client you may add it to the Maily.shared.clients, or contribute to the library.

Requirements

  • iOS 10+
  • Xcode 10.2+ (built for Swift 5)

Author

Ivan Smetanin, smetanin23@yandex.ru

License

Maily is available under the MIT license. See the LICENSE file for more info.