请告诉我如何发送电子邮件?
这意味着我有一个uibutton当用户点击我想从应用程序检索一些数据并将其发送到技术助手的邮件ID ..有没有任何简单的方法来做到这一点?
Jha*_*iya 11
你必须使用MFMailComposeViewController类和MFMailComposeViewControllerDelegate协议,
PeyloW在这里给出了以下代码:
首先发送消息:
MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"My Subject"];
[controller setMessageBody:@"Hello there." isHTML:NO];
[self presentModalViewController:controller animated:YES];
[controller release];
Run Code Online (Sandbox Code Playgroud)
然后用户完成工作,并及时获得委托回调:
- (void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError*)error;
{
if (result == MFMailComposeResultSent) {
NSLog(@"It's away!");
}
[self dismissModalViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
无需创建UIButton.您必须使用MFMailComposeViewController类和MFMailComposeViewControllerDelegate协议来发送邮件..
为了方便您创建电子邮件应用程序,您可以参考以下链接.
http://mobileorchard.com/new-in-iphone-30-tutorial-series-part-2-in-app-email-messageui/
它可能对您创建应用程序有所帮助
| 归档时间: |
|
| 查看次数: |
11764 次 |
| 最近记录: |