oscarimonbox
8/31/2016 - 7:39 AM

Enviar mail

Enviar mail

1) añadir a la clase (.h)
#import <MessageUI/MessageUI.h> 
y el delegate: <MFMailComposeViewControllerDelegate>

2) en el .m
- (IBAction)showEmail:(id)sender {
    // Email Subject
    NSString *emailTitle = @"Test Email";
    // Email Content
    NSString *messageBody = @"iOS programming is so fun!";
    // To address
    NSArray *toRecipents = [NSArray arrayWithObject:@"support@appcoda.com"];
    
    MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
    mc.mailComposeDelegate = self;
    [mc setSubject:emailTitle];
    [mc setMessageBody:messageBody isHTML:NO];
    [mc setToRecipients:toRecipents];
 
    // Present mail view controller on screen
    [self presentViewController:mc animated:YES completion:NULL];
 
}