如何在电子邮件发送中加载 plist 电子邮件地址
Posted
技术标签:
【中文标题】如何在电子邮件发送中加载 plist 电子邮件地址【英文标题】:How to load plist email address in email send 【发布时间】:2014-11-28 04:31:27 【问题描述】:我设置了一个 plist,plist 有很多电子邮件地址,然后我想从 plist 加载电子邮件地址并发送电子邮件。
谢谢!!
【问题讨论】:
【参考方案1】:NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *docPath = [documentsDirectory stringByAppendingPathComponent:@"filename.plist"];
NSArray *emailNames = [NSArray arrayWithContentsOfFile:docPath];
发送您的电子邮件:
NSString *emailTitle = @"Email Title";
NSString *messageBody = @"This is where the body goes";
NSArray *toRecipents = [NSArray arrayWithArray:emailNames];
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];
【讨论】:
以上是关于如何在电子邮件发送中加载 plist 电子邮件地址的主要内容,如果未能解决你的问题,请参考以下文章