作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
请告诉我如何发送电子邮件?
这意味着当用户单击我想要从应用程序检索一些数据并将其发送到技术助理的邮件 ID 时,我有一个 uibutton。有没有简单的方法可以做到这一点?
最佳答案
您必须使用 MFMailComposeViewController
类和 MFMailComposeViewControllerDelegate
协议(protocol),
PeyloW 在他的回答 here 中为此提供了以下代码:
First to send a message:
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];
Then the user does the work and you get the delegate callback in time:
- (void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError*)error;
{
if (result == MFMailComposeResultSent) {
NSLog(@"It's away!");
}
[self dismissModalViewControllerAnimated:YES];
}
关于iphone - 如何在 iOS 应用程序中使用电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5513307/
我是一名优秀的程序员,十分优秀!