Send email to third-party mail clients easy.
Client | URL Scheme |
---|---|
Gmail | googlegmail |
Dispatch | x-dispatch |
Spark | readdle-spark |
Airmail | airmail |
Microsoft Outlook | ms-outlook |
Yahoo Mail | ymail |
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'
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"))
]
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>
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
To localize action sheet "Cancel" button just change cancelButtonTitle
property in Maily.shared
.
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.
- iOS 10+
- Xcode 10.2+ (built for Swift 5)
Ivan Smetanin, [email protected]
Maily is available under the MIT license. See the LICENSE file for more info.