Latest 0.4.1
Homepage https://github.com/snipsco/Postal
License MIT
Platforms ios 8.0, osx 10.10
Authors ,

Build Status
Carthage
Pods
Swift 3.0.x
Platforms

Postal is a swift framework providing simple access to common email providers.

Example

Connect

let postal = Postal(configuration: .icloud(login: "[email protected]", password: "mypassword"))
postal.connect { result in
    switch result {
    case .success:
        print("success")
    case .failure(let error):
        print("error: (error)")
    }
}

Search

let filter = .subject(value: "Foobar") && .from(value: "[email protected]")
postal.search("INBOX", filter: filter) { result in
    switch result {
    case .success(let indexes):
        print("success: (indexes)")
    case .failure(let error):
        print("error: (error)")
    }
}

Fetch

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)")
    }
}

What about Mailcore ?

Postal does not address the same goal as MailCore. You can take a look at our thoughts in the TechnicalNotes document.

Provider quirks

Email protocol is standardized. However providers implementations often provides extension or variations of these standards.
We tried to build a document to synthesize working around these variations here: ProviderQuirks.

Contributing

Postal has been a great effort and we could really use your help on many areas:

  • Finding and reporting bugs.
  • New feature suggestions.
  • Answering questions on issues.
  • Documentation improvements.
  • Reviewing pull requests.
  • Fixing bugs/new features.
  • Improving tests.
  • Contribute to elaborate the Roadmap.

If any of that sounds cool to you, please send a pull request!

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms that you can find here: CodeOfConduct.

Requirements

  • Xcode 8
  • OS X 10.10 or later
  • iOS 8.0 or later

Installation

Carthage

Postal is Carthage compatible.

  • Add github "snipsco/Postal" to your Cartfile.
  • Run carthage update.

CocoaPods

Postal also can be used by CocoaPods.

  • Add the followings to your Podfile:

    use_frameworks!
    pod 'Postal'
    • For ReactiveSwift extensions, this project will include them as dependencies. You can do this via CocoaPods subspecs.
    pod 'Postal/ReactiveSwift'
  • Run pod install.

Manual

  1. Add the Postal repository as a submodule of your application’s repository.

    git submodule add https://github.com/snipsco/Postal.git
    git submodule update --init --recursive
  2. Drag and drop Postal.xcodeproj and Carthage/Checkouts/Result/Result.xcodeproj into your application’s Xcode project or workspace.
  3. On the “General” tab of your application target’s settings, add Postal.framework and Result.framework to the “Embedded Binaries” section.
  4. If your application target does not contain Swift code at all, you should also set the EMBEDDED_CONTENT_CONTAINS_SWIFT build setting to “Yes”.

License

Postal is released under the MIT License.

Latest podspec

{
    "name": "Postal",
    "version": "0.4.1",
    "summary": "A swift framework for working with emails.",
    "description": "A Swift framework for working with emails. Simple and quick to use. Built on top of libetpan.",
    "homepage": "https://github.com/snipsco/Postal",
    "license": "MIT",
    "authors": {
        "Kevin Lefevre": "[email protected]",
        "Jeremie Girault": "[email protected]"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "source": {
        "git": "https://github.com/snipsco/Postal.git",
        "tag": "v0.4.1"
    },
    "default_subspecs": "Core",
    "osx": {
        "pod_target_xcconfig": {
            "SWIFT_INCLUDE_PATHS": ""$(SRCROOT)/Postal/dependencies" "$(SRCROOT)/Postal/dependencies/build/macos/include"",
            "LIBRARY_SEARCH_PATHS": ""$(SRCROOT)/Postal/dependencies/build/macos/lib"",
            "HEADER_SEARCH_PATHS": ""$(SRCROOT)/Postal/dependencies/build/macos/include""
        }
    },
    "pushed_with_swift_version": "3.0.2",
    "subspecs": [
        {
            "name": "Core",
            "source_files": "Postal/*.{swift,h}",
            "pod_target_xcconfig": {
                "GCC_PREPROCESSOR_DEFINITIONS": "$(inherited) NO_MACROS=1"
            },
            "ios": {
                "pod_target_xcconfig": {
                    "SWIFT_INCLUDE_PATHS": ""$(SRCROOT)/Postal/dependencies" "$(SRCROOT)/Postal/dependencies/build/ios/include"",
                    "LIBRARY_SEARCH_PATHS": ""$(SRCROOT)/Postal/dependencies/build/ios/lib"",
                    "HEADER_SEARCH_PATHS": ""$(SRCROOT)/Postal/dependencies/build/ios/include""
                }
            },
            "preserve_paths": "dependencies",
            "libraries": [
                "etpan",
                "sasl2",
                "z",
                "iconv"
            ],
            "dependencies": {
                "Result": [
                    "~> 3.1.0"
                ]
            }
        },
        {
            "name": "ReactiveCocoa",
            "dependencies": {
                "Postal/ReactiveSwift": []
            }
        },
        {
            "name": "ReactiveSwift",
            "source_files": "Postal/ReactiveSwift/*.swift",
            "dependencies": {
                "Postal/Core": [],
                "ReactiveSwift": [
                    "1.0.0"
                ]
            }
        }
    ]
}

Pin It on Pinterest

Share This