我正在从 iphone 应用程序发送电子邮件,它工作正常我想在电子邮件中添加 cc 任何想法如何做到这一点。我正在使用以下代码,请你帮助如何在其中添加 CC。
谢谢。
初始化控制器以发送电子邮件
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSString*giveFileName=@"CPAC_Contract_Equine";
NSString *fileName;
//fileName = [[NSString alloc]initWithFormat:@"%@.pdf",giveFileName];
fileName = [[NSString alloc]initWithFormat:@"%@",giveFileName];
NSString*myFileName=@"W9.pdf";
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *pdfFileName = [documentsDirectory stringByAppendingPathComponent:fileName];
NSMutableData *myPdfData = [NSMutableData dataWithContentsOfFile:pdfFileName];
NSString *pathJam = [[NSBundle mainBundle] pathForResource:@"W9" ofType:@"pdf"];
NSData *myDataJam = [NSData dataWithContentsOfFile: pathJam];
NSArray * toRecipients = [NSArray arrayWithObject:@""];
[picker setToRecipients:toRecipients];
[picker setSubject:@"CPAC Contract for Equine-Sam Veterinarian"];
[picker addAttachmentData:myPdfData mimeType:@"application/pdf" fileName:giveFileName];
NSString * emailBody =@"<html><body>Thank you for your participation in Consulting<br>Practitioner and Client Program.</br><br>Attached is the copy of your signed contract for your records<p>Please email or fax your completed W-9 form to<br>our PEI Support Team<br>Email:PEISupportServices@zoetis.com<br>Fax:800-741-1310<body></html>";
[picker setMessageBody:emailBody isHTML:YES];
[self.navigationController presentViewController:picker animated:YES completion:nil];