- 创建可变字符串
- 添加收件人
- 添加抄送人,如果没有设置成空即可
- 添加密送,如果没有设置成空
- 添加主题
- 添加邮件内容
&body=<b>email</b> body!
以标签的形式添加内容.
NSMutableString *mailUrl = [[NSMutableString alloc]init];
//添加收件人
NSArray *toRecipients = [NSArray arrayWithObject: @"xxxxxxx@qq.com"];
[mailUrl appendFormat:@"mailto:%@", [toRecipients componentsJoinedByString:@","]];
//添加抄送
NSArray *ccRecipients = [NSArray arrayWithObjects:@"", @"", nil];
[mailUrl appendFormat:@"?cc=%@", [ccRecipients componentsJoinedByString:@","]];
//添加密送
NSArray *bccRecipients = [NSArray arrayWithObjects:@"", nil];
[mailUrl appendFormat:@"&bcc=%@", [bccRecipients componentsJoinedByString:@","]];
//添加主题
[mailUrl appendString:@"&subject=关于加班笔记"];
//添加邮件内容
[mailUrl appendString:@"&body=<b>email</b> body!"];
NSString* email = [mailUrl stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:email]];