应用程序内邮件帐户选择

时间:2011-05-06 13:14:59

标签: iphone cocoa-touch mfmailcomposeviewcontroller

是否可以让用户选择他想要发送邮件的帐户?

我可以发送邮件,但它始终来自默认帐户,我希望用户能够选择将用于发送电子邮件的帐户。

1 个答案:

答案 0 :(得分:0)

如果用户点击发件人:地址,他们可以切换帐户,此行为与普通电子邮件编辑器相同。

这是我用来启动邮件编辑器的代码:

MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];

AssetsLibraryBroker *libraryBroker = [[AssetsLibraryBroker alloc] init];
// loop through selected items;
for (NSString *fileName in [self.selectedDictionary allKeys]) {
    NSLog(@"fileName: %@", fileName);
    [controller addAttachmentData:[libraryBroker getAssetDataForFileName:fileName inManagedObjectContext:managedObjectContext]  mimeType:@"image/jpeg" fileName:[NSString stringWithFormat:@"%@.jpg", fileName]];
}

[libraryBroker release];

[self presentModalViewController:controller animated:YES];
[controller release];

我的邮件编辑器有一个可点击的“发件人:”字段。

Launched from Code select an account