I want to make it so that when my app's user types their email address into my UITextField, tapping the "complete purchase" button will automatically send an email populated with certain details to the address they input. This seems like it should be simple enough, however I can't seem to get it to work without popping open the Apple Mail client? Right now, I have the following code in place:
ViewController.m
- (void)sendProgram {
if([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailCont = [[MFMailComposeViewController alloc] init];
mailCont.mailComposeDelegate = self; // Required to invoke mailComposeController when send
[mailCont setSubject:@"Your Purchase!"];
[mailCont setToRecipients:[NSArray arrayWithObject:@"brittany@test.ca"]];
[mailCont setMessageBody:@"Here is the program you ordered! Please click the following link to download." isHTML:NO];
[self presentViewController:mailCont animated:YES completion:nil];
}
}
And technically, once the mail client pops open with all of these details filled in, all I have to do is hit the send button. However I want this information to be sent without the mail client ever opening. Is this possible?