本文介绍了应用程序ondevice方法的Mail Composer问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将此代码用于邮件

I am using this code for mail

MFMailComposeViewController * picker = [[MFMailComposeViewController分配]初始化];

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

picker.mailComposeDelegate =自我;

picker.mailComposeDelegate = self;

NSString * msgTitle = @样本标题";

NSString *msgTitle = @"Sample Title";

[picker setSubject:msgTitle];

NSArray * toRecipients = [[NSArray alloc] init];

NSArray *toRecipients =[[NSArray alloc] init];

NSArray * ccRecipients = [[NSArray alloc] init];

NSArray *ccRecipients =[[NSArray alloc] init];

NSArray * bccRecipients = [[NSArray alloc] init];

NSArray *bccRecipients =[[NSArray alloc] init];

[picker setToRecipients:toRecipients];

[picker setToRecipients:toRecipients];

[picker setCcRecipients:ccRecipients];

[picker setCcRecipients:ccRecipients];

[picker setBccRecipients:bccRecipients];

[picker setBccRecipients:bccRecipients];

NSString *sum = @"The Email Body string is here";

NSString * emailBody;

NSString *emailBody;

emailBody = [NSString stringWithFormat:@%@",sum];

emailBody = [NSString stringWithFormat:@"%@",sum];

[picker setMessageBody:emailBody isHTML:YES];

[picker setMessageBody:emailBody isHTML:YES];

[self presentModalViewController:picker animation:YES];

[self presentModalViewController:picker animated:YES];

[选择器释放];

有效,

我想知道,是否需要修改

i want to know,is it required to modify

-(void)launchMailAppOnDevice{NSString *收件人= @"mailto:[email protected]?cc = second @ example.com,third @ example.com& subject =加利福尼亚打招呼!";NSString * body = @& body =正在阳光明媚的加利福尼亚下雨!";

-(void)launchMailAppOnDevice{ NSString *recipients = @"mailto:[email protected][email protected],[email protected]&subject=Hello from California!"; NSString *body = @"&body=It is raining in sunny California!";

NSString *电子邮件= [NSString stringWithFormat:@%@%@",收件人,正文];email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSString *email = [NSString stringWithFormat:@"%@%@", recipients, body]; email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];}

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];}

如果是,那么我如何用这种方法进行修改.

if yes thenhow i modify in this method.

请帮助我.

推荐答案

如果电子邮件地址是静态提供的,并显示在收件人"地址中.

If email address is given statically and displayed in To address.

您可以使用此代码,

   MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
   mail.mailComposeDelegate = self;
if ([MFMailComposeViewController canSendMail]) {    
    [mail setToRecipients:[NSArray arrayWithObjects:@"[email protected]",nil]];

    [self presentModalViewController:mail animated:YES];

}

 [mail release];

还有

查看我的答案

祝你好运.

这篇关于应用程序ondevice方法的Mail Composer问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 03:33