gpt4 book ai didi

iphone - 如何在 iOS 应用程序中使用电子邮件?

转载 作者:行者123 更新时间:2023-12-03 19:26:38 25 4
gpt4 key购买 nike

请告诉我如何发送电子邮件?

这意味着当用户单击我想要从应用程序检索一些数据并将其发送到技术助理的邮件 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com