iOS:如何通过MFMailComposeController发送消息后如何获取消息正文,主题和收件人

问题描述:

我正在通过以下方法发送电子邮件:

I am sending email via following method:

-(void) sendEmailOpenControllerWithSubject:(NSString *)subject messsageBody:(NSString *) message
{
    MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
    controller.mailComposeDelegate = self;
    [controller setSubject:subject];
    [controller setMessageBody:message isHTML:NO];
    [controller setToRecipients:[[NSArray alloc] initWithObjects:currentProspect.email, nil]];
    if (controller) [self presentModalViewController:controller animated:YES];
}

我正在设置邮件正文主题和收件人,但是用户可能会在MailComposer中更改这些属性.

I am setting message body subject and recipient but it is likely that user changes these attribute in MailComposer.

我需要什么:

因此,我想在发送电子邮件后获取诸如邮件正文,主题和收件人之类的内容.用户可能已通过邮件编辑器更改了这些设置.

So I want to get the contents like message body,subject and recipients after the email is sent. As it is possible that user has changed these via mail composer.

从iOS 5开始,您可以注册以接收有关文本消息发送可用性的更改的通知.

Starting in iOS 5, you can register to be notified of changes to the availability of text message sending.

A userInfo dictionary key for the MFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification

NSString *const MFMessageComposeViewControllerTextMessageAvailabilityKey;

有关Message UI Framework的更多信息,请参见此处

Refer more on Message UI Framework here