if ([MFMailComposeViewControllercanSendMail]) {
MFMailComposeViewController *mailVC = [[MFMailComposeViewControlleralloc] init];
mailVC.mailComposeDelegate =self;
[mailVCsetSubject:@"邮件主题"];
[mailVCsetToRecipients:[NSArrayarrayWithObjects:@"example@gmail.com",nil]];
[mailVC setMessageBody:@"邮件内容" isHTML:NO];
[self.navigationControllerpresentModalViewController:mailVC animated:YES];
[mailVCrelease];
}else {
NSString* str = [NSStringstringWithFormat:@"mailto:%@?subject=%@&body=%@",
@"example@gmail.com", @"邮件主题", @"邮件内容"];
str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplicationsharedApplication] openURL:[NSURLURLWithString:str]];
}
当设备没设置邮箱时,会跳转到设置界面提示用户添加邮箱;