我使用以下内容来显示 mailViewController
-(IBAction)sendMailbuttonTapped {
if([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailCont = [[MFMailComposeViewController alloc] init];
mailCont.mailComposeDelegate = self;
[mailCont setSubject:@"yo!"];
[mailCont setToRecipients:[NSArray arrayWithObject:@"surendherbtech@gmail.com"]];
[mailCont setMessageBody:@"Don't ever want to give you up" isHTML:NO];
[self presentModalViewController:mailCont animated:YES];
[mailCont release];
}
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
[self dismissModalViewControllerAnimated:YES];
}
它显示得很好,但我现在需要的是,我希望在用户点击按钮时在用户不知情的情况下发送邮件。它必须在没有用户单击发送选项的情况下发送。
谁能告诉我如何自动发送邮件提前谢谢