Git Product home page Git Product logo

supportemail's Introduction

SupportEmail

Platform CocoaPods Swift Version

Prepopulates emails with support information in iOS apps

About

SupportEmail is about simplifying support for apps. By prepopulating device information in your embedded support email link, you can save time and needless back and forth between you and your users. Check out Countdown Widget to see SupportEmail in action.

Requirements

  • Xcode 10.0+
  • iOS 8.0+
  • Swift 4.2+

Installation

CocoaPods

The preferred installation method is with CocoaPods. Add the following to your Podfile:

pod 'SupportEmail', '~> 2.3.0'

Usage

Due to how MFMailComposeViewController works, you must retain a reference to SupportEmail outside of where you are sending the email.

var supportEmail: SupportEmail?

Using SupportEmail is really simple and has just one method. send will allow you to craft the email and handle the end result:

supportEmail = SupportEmail()
supportEmail.send(to: ["[email protected]"], subject: "Support", from: self) { result, error in
    switch result {
    case .cancelled:
        print("Message cancelled")
    case .failed:
        print("Message failed")
    case .saved:
        print("Message saved")
    case .sent:
        print("Message sent")
    }
}

The send function takes 3 arguments:

  • An array of email address the support email should be sent to
  • The subject of the support email
  • The view controller the MFMailComposeViewController is to be presented on

Advanced

SupportEmail also supports providing custom arguments.

supportEmail.customFields = ["Pro Upgrade": "Yes"]

Customization

SupportEmail allows you to provide choose between sending a text file or just content in the email body. Defaults to sending as a text file. If you are sending as a text file you can also specify the file name.

supportEmail.sendAsTextFile = true
supportEmail.fileName = "Sample File Name"

SupportEmail allows you to provide a tintColor in order to customize the appearance of the navigation bar.

supportEmail.tintColor = .blue

SupportEmail allows you to provide a baseLocale in order to localize the system locale in the email. Defaults to en-US.

supportEmail.baseLocale = Locale(identifier: "es-US")

License

This code is distributed under the terms and conditions of the MIT license.

supportemail's People

Contributors

schayes04 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.