Skip to content

A simple class that cares about email and MessageUI, so you don't have to

License

Notifications You must be signed in to change notification settings

chrisladd/CGLMail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CGLMail

CGLMail makes it easy to send email from any class in your app, without implementing the MFMailComposeViewControllerDelegate protocol all over the place. It was initially written to centralize the submission of feedback emails into one class.

Usage

If you're using cocoapods like you should, add CGLMail to your podfile:

pod 'CGLMail', '~> 0.1'

For example, you can get a view controller to send an email like so:

UIViewController *mailVC = [CGLMailHelper mailViewControllerWithRecipients:@[@"[email protected]"] 
                                                                   subject:@"Hi Mom!" 
                                                                   message:@"Hi Mom, \n\nJust wanted to check in and say hello!\n\nLove, \nChris" 
                                                                    isHTML:NO 
                                                            includeAppInfo:NO 
                                                                completion:nil];

Which would end up looking somthing like this:

Support Screenshot

Or, to generate a user support email, with diagnostic info about the user's app and device:

UIViewController *mailVC = [CGLMailHelper supportMailViewControllerWithRecipient:@"[email protected]" 
                                                                         subject:@"Support Email" 
                                                                      completion:nil];

Which would yield a view controller that looks like this:

Support Screenshot

Safety First

Note that CGLMailHelper will return nil if [MFMailComposeViewController canSendMail] returns NO, e.g. if the user has not yet set up her email address. Be sure to check for nil! UIKit will throw an exception if you try to present a nil view controller.

About

A simple class that cares about email and MessageUI, so you don't have to

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •