Sending invitation from contact list in iPhone

161 views Asked by At

In an app I have to send invite through contact details in iPhone. I know that contact details can be fetch by ABPeoplePickerNavigationController.And on a button action, I am able to get contact details. Now, on selecting any contact name I should be able to send a mail to that contact user.

Now, please share some information.

1

There are 1 answers

0
TeaCupApp On BEST ANSWER

Check if the contact has email if it does then,

NSString *subject = [NSString stringWithFormat:@"Subject"];
NSString *mail = [NSString stringWithFormat:@"[email protected]"];

NSURL *url = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"mailto:?to=%@&subject=%@", 
                                           [mail stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding], 
                                           [subject stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]];

[[UIApplication sharedApplication] openURL:url];

FYI : If the user hasn't set the email for particular contact then you won't be able to send email anyway :)