开发者

Easy way to open the Mail application with an pre-defined message subject and body?

In my app the user generates text content. I want to enab开发者_StackOverflowle the user to launch the Mail application, which then should contain a specified subject and message body. Like: You write a poem in my app and then want to send it to your new girlfriend. So you tap a mail icon and the Mail app opens, containing already an subject and message body with your poem inside.

Someone said there is a kind of URL mechanism for that?


You can use MFMailComposeViewController for sending the mail.

-(void)OpenMail{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"my new poem"];
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
[picker release];
}

emailBody is string which contains the poem.

All the best.


Apple URL Scheme Reference: Mail Links lists all your options.

Or you use MFMailComposeViewController.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜