iOS发送邮件功能

来源:互联网 发布:诺基亚rm1013下载软件 编辑:程序博客网 时间:2024/09/21 09:24
- (void)test{NSURL *url = [NSURL URLWithString:@"mailto://邮箱地址"];[[UIApplication sharedApplication] openURL:url];} - (void)sendMail{MFMailComposeViewController *vc = [[MFMailComposeViewController alloc] init];//设置主题[vc setSubject:@"联系作者"];//设置邮件内容[vc setMessageBody:@"请说出您对软件的建议" isHTML:YES];//设置发送人[vc setToRecipients:@[@"输入邮箱地址"]];//抄送//[vc setCcRecipients:@[@""]];//密送//[vc setBccRecipients:@[@""]];vc.mailComposeDelegate = self;[self presentViewController:vc animated:YES completion:nil];} - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{//关闭邮件界面[controller dismissViewControllerAnimated:YES completion:nil];} #pragma mark – 发送按钮- (IBAction)sendBtn {[self sendMail];}

0 0
原创粉丝点击