Skip to content

Instantly share code, notes, and snippets.

View glennposadas's full-sized avatar
🏠
Working from home

Glenn Posadas glennposadas

🏠
Working from home
View GitHub Profile
@glennposadas
glennposadas / sendmailcore2objc.m
Last active March 4, 2021 00:10
Sample full code of sending an email using MailCore2 in Objective-C
- (IBAction)sendEmail:(id)sender {
MCOMessageBuilder *builder = [[MCOMessageBuilder alloc] init];
MCOAddress *address = [MCOAddress addressWithDisplayName:@"Uplant Support" mailbox:@"noreply.uplant@gmail.com"];
NSArray *to = [NSArray arrayWithObject:[MCOAddress addressWithDisplayName:@"Glenn Posadas" mailbox:@"admin@glennvon.com"]];
[[builder header] setFrom:address];
[[builder header] setTo:to];
[[builder header] setSubject:@"This is a nice subject"];
[builder setHTMLBody:@"The motherloving body."];
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Get view controllers from storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let rootViewController = storyboard.instantiateViewControllerWithIdentifier("RootViewController") as! RootViewController
let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideViewController") as! SideViewController
// Add a navigation controller to our main screen
var rootNavCon = RootNavigationController(rootViewController: rootViewController)
rootNavCon = storyboard.instantiateViewControllerWithIdentifier("RootNavigationController") as! RootNavigationController
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Get view controllers from storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let rootViewController = storyboard.instantiateViewControllerWithIdentifier("RootViewController") as! RootViewController
let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideViewController") as! SideViewController
let sideNavigationController = SideNavigationController(rootViewController: rootViewController, leftViewController: sideViewController)
// Configure the window with the SideNavigationController as the root view controller
window = UIWindow(frame: UIScreen.mainScreen().bounds)