gpt4 book ai didi

ios - 如何在 iOS 的邮件中只允许一个收件人

转载 作者:行者123 更新时间:2023-11-28 22:42:16 25 4
gpt4 key购买 nike

我正在创建一个“联系我们”按钮,允许用户通过电子邮件联系我们的支持团队(我使用的是 iOS 6)。但我希望邮件编辑器只向我们的支持团队发送电子邮件,不允许用户添加或删除收件人电子邮件地址。

DemoProject.h

#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>

@interface SimpleEmailViewController : UIViewController <MFMailComposeViewControllerDelegate> // Add the delegate
- (IBAction)showEmail:(id)

DemoProject.m

 - (IBAction)showEmail:(id)sender {
// Email Subject
NSString *emailTitle = @"Test Email";
// Email Content
NSString *messageBody = @"iOS programming is so fun!";
// To address
NSArray *toRecipents = [NSArray arrayWithObject:@"support@app.com"];

MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
[mc setSubject:emailTitle];
[mc setMessageBody:messageBody isHTML:NO];
[mc setToRecipients:toRecipents];

// Present mail view controller on screen
[self presentViewController:mc animated:YES completion:NULL];

}

- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}

// Close the Mail Interface
[self dismissViewControllerAnimated:YES completion:NULL];
} `

最佳答案

你不能限制它。您可以预填字段,但不能限制用户编辑收件人。

关于ios - 如何在 iOS 的邮件中只允许一个收件人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14174633/

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