MFMailComposeViewController in iphone app
hii every one
can we use " MFMailComposeViewController " with out using " presentModalViewController" , i mean i need to send email with out navigating to that mail composer page
i did a test project with following code
- (IBAction)buttonPressed {
arrRecipients = [[NSMutableArray alloc]in开发者_开发百科it];
[arrRecipients addObject:@"xxxxxxx@gmail.com"];
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
[mailController setSubject:@"Ravikiran test mail"];
[mailController setToRecipients:arrRecipients];
[mailController setMessageBody:@"this is my test app" isHTML:YES];
[self presentModalViewController:mailController animated:YES];
[mailController release];
}
it is sending mail but it is navigating to mail composer page & then its sending but i need to send mail just on click of the button
No, you cannot use MFMailComposeViewController
to send an email without user interaction. There are probably 3rd parties libraries that let you do this, but the iOS SDK does not allow you to.
Also, you're leaking the arrRecipients
array.
Best way for your needs is to have a web service which sends the data to an email id. its always to good to inform the user in some way before sending the mail.
Thanks!
精彩评论