【问题标题】:Mail Composer Problem with app ondevice method应用程序 ondevice 方法的邮件撰写器问题
【发布时间】:2011-02-26 17:24:39
【问题描述】:

我正在使用此代码发送邮件

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

picker.mailComposeDelegate = self;

NSString *msgTitle = @"示例标题";

[picker setSubject:msgTitle];

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

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

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

[picker setToRecipients:toRecipients];

[picker setCcRecipients:ccRecipients];

[picker setBccRecipients:bccRecipients];

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

NSString *emailBody;

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

[picker setMessageBody:emailBody isHTML:YES];

[self presentModalViewController:picker animated:YES];

[选择器发布];

有效,

我想知道,是否需要修改

-(void)launchMailAppOnDevice { NSString *recipients = @"mailto:first@example.com?cc=second@example.com,third@example.com&subject=你好,来自加利福尼亚!"; NSString *body = @"&body=阳光明媚的加利福尼亚正在下雨!";

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

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

如果是,那么 我如何在这种方法中进行修改。

请帮助我。

【问题讨论】:

    标签: iphone objective-c


    【解决方案1】:

    如果电子邮件地址是静态给出并显示在收件人地址中。

    您可以使用此代码,

       MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
       mail.mailComposeDelegate = self;
    if ([MFMailComposeViewController canSendMail]) {    
        [mail setToRecipients:[NSArray arrayWithObjects:@"AAA@BBB.com",nil]];
    
        [self presentModalViewController:mail animated:YES];
    
    }
    
     [mail release];
    

    还有

    see my answer

    祝你好运。

    【讨论】:

      猜你喜欢
      • 2011-08-28
      • 1970-01-01
      • 2011-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-24
      相关资源
      最近更新 更多