iOS 打开本地邮箱 APP

-(void)launchNativeMailApp {

NSMutableString *mailUrl = [[NSMutableString alloc]init];
//add Addressee
NSArray *toRecipients = [NSArray arrayWithObject: @"[email protected]"];
[mailUrl appendFormat:@"mailto:%@", [toRecipients componentsJoinedByString:@","]];
//add Carbon Copy
[mailUrl appendFormat:@"?cc="];
//add blind carbon copy
[mailUrl appendFormat:@"&bcc="];
//add subject
NSString *subject = [NSString stringWithFormat:@"&subject=From  - %lu",(unsigned long)[Context shared].accountManager.student.sid];
[mailUrl appendString:subject];
//add content
NSString *message = @"&body=";
message = [message stringByAppendingString:@"请告诉我们您的问题:
"]; message = [message stringByAppendingString:@"







"]; // we skip 8 lines message = [message stringByAppendingString:[NSString stringWithFormat:@"Student ID:%lu
", (unsigned long)[Context shared].accountManager.student.sid]]; message = [message stringByAppendingString:[NSString stringWithFormat:@"School Code:%@
", [Context shared].accountManager.student.course.courseSchool]]; message = [message stringByAppendingString:[NSString stringWithFormat:@"Device:%@
", [UIDevice getDeviceName]]]; message = [message stringByAppendingString:[NSString stringWithFormat:@"iOS Version:%@
", [[UIDevice currentDevice] systemVersion]]]; message = [message stringByAppendingString:[NSString stringWithFormat:@"Region:%@
", [Context shared].accountManager.student.profile.country]]; [mailUrl appendString:message]; NSString* email = [mailUrl stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; [[UIApplication sharedApplication] openURL: [NSURL URLWithString:email]]; }

你可能感兴趣的:(iOS 打开本地邮箱 APP)