Search code examples
iosxcodemfmailcomposeviewcontroller

Add multiple recipients to MFMailcomposer torecepients: field - Xcode IOS


I have an existing program that enables me to 'tag' an email and add it to an ARRAY , I am then trying to use that ARRAY in my existing program and add it

array2 has had a group of email addresses added to it so consists of "[email protected],[email protected]"

NSArray *toRecipients = [NSArray addObjectToArray:array2]; 

[composer setToRecipients:toRecipients];

Please don't 'flame' my code or message as I am typing the above from memory


Solution

  • MFMailComposeViewController *recipntNames = [[MFMailComposeViewController alloc] init];
    NSArray *toRecipientsNames = [NSArray arrayWithObjects:@"[email protected]",@"[email protected]",nil];   
    [recipntNames setToRecipients:toRecipientsNames];
    

    or use this array2 is your NSMutableArray Name

    NSArray *array = [array2 copy];
    
    [recipntNames setToRecipients:toRecipientsNames];
    

    need more reference use this link