I am using iPhone in-App email feature to send email thru my app.
The email goes fine but I am having hard time trying to figure out how to retrive email addresses to which the email was sent.
Here is my code:
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Test"];
// Fill out the email body text
NSString *emailBody = [NSString stringWithFormat:@"This is a test data"];
[picker setMessageBody:emailBody isHTML:YES];
picker.navigationBar.barStyle = UIBarStyleBlack;
[self presentModalViewController:picker animated:YES];
[picker release];
Is there any way to retrive those email addresses from this function:
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
Thanks!
No you cannot. This is private information.
You could make your own e-mail entry form and then pre-fill to field of the
MFMailComposeViewControllerusing- (void)setToRecipients:(NSArray*)toRecipients. But you cannot sure that the user doesn’t change the address onceMFMailComposeViewControlleris shown.This answer to a similar question suggests using custom IMAP libary like Mailcore instead of built in
MFMailComposeViewController.