I have implemented mail composer. But it opens mail composer whenever user had implemented mail account in iphone. My requirement is If user had not implemented mail accont , the mail setup should be opened.
Asked
Active
Viewed 151 times
-1
-
What have you done so far? Provide some code! – Neysor Mar 29 '12 at 05:30
1 Answers
2
Try this code...
if ([mailClass canSendMail])
{
[self displayComposerSheet];
}
else
{
//open mail set up
[self launchMailAppOnDevice];
}
// Launches the Mail application on the device.
-(void)launchMailAppOnDevice
{
NSString *recipients = @"mailto:first@example.com?cc=second@example.com,third@example.com&subject=Hello from California!";
NSString *body = @"&body=It is raining in sunny California!";
NSString *email = [NSString stringWithFormat:@"%@%@", recipients, body];
email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
}

Raj Subbiah
- 1,292
- 11
- 20
-
@ Raj Subbiah - Thanks a lot. You understand very well my requirement. – DipakSonara Mar 29 '12 at 06:31