我正在使用此代码发送邮件
MFMailComposeViewController * picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSString * msgTitle = @“Sample Title”;
[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];
[选择器发布];
它有效,
我想知道,是否需要修改
- (无效)launchMailAppOnDevice { NSString * recipients = @“mailto:first@example.com?cc = second @ example.com,third @ example.com& subject = Hello from California!”; NSString * body = @“& body =正在阳光明媚的加利福尼亚下雨!”;
NSString * email = [NSString stringWithFormat:@“%@%@”,收件人,正文]; email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]]; }
如果是的话 我如何在这种方法中修改。
请帮帮我。
答案 0 :(得分:0)
如果静态地给出了电子邮件地址并显示在收件人地址中。
您可以使用此代码
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];
并且
祝你好运。