Reputation: 6551
I am facing a problem when multiple recipients for my mail, i have two attachments there by default.Is there anything i have to do when iam sending a mail to multiple recipients other than the below code; (I have to select or type recipient id's from UI)
if ([MFMailComposeViewController canSendMail])
{
[self printPdfAndCsv];// code to generate pdf & csv
MFMailComposeViewController* mailComposer = [[MFMailComposeViewController alloc] init];
mailComposer.mailComposeDelegate = self;
// attaching PDF File.
[mailComposer addAttachmentData:[NSData dataWithContentsOfFile:self.pdfFilePath]
mimeType:@"Application/pdf" fileName:[NSString stringWithFormat:@"pdfName-%@.pdf", selectedProjectName ]];
// attaching CSV File.
[mailComposer addAttachmentData:[NSData dataWithContentsOfFile:self.csvFilePath]
mimeType:@"text/csv" fileName:[NSString stringWithFormat:@"csvName-%@.csv", selectedProjectName ]];
[self presentViewController:mailComposer animated:YES completion:nil];
}
Iam a starter in iPhone development, so i need your valuable help.
Upvotes: 0
Views: 1168
Reputation: 1752
If you want to sent mail to multiple user then you can use:
[mailController setToRecipients:[NSArray arrayWithObject:@"[email protected]",@"[email protected]",@"[email protected]",nil]];
Upvotes: 1
Reputation: 6551
I got a solution from rmaddy on his comment,
There may be problem with one of the email addresses we tested.
Maybe the email ended up appearing as junk mail (spam).
Once the user taps Send, it's out of our control. (and in my case; i found the mails that i have sent were in spam box)
Upvotes: 0
Reputation: 4089
Try this
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
NSArray *toRecipients = [NSArray arrayWithObjects:@"[email protected]",@"[email protected]",nil];
[picker setToRecipients:toRecipients];
Upvotes: 1