大发体育娱乐在线-大发体育娱乐官方网站-大发体育娱乐登录网址
做最好的网站

张开网址,ios发送邮件

来源:http://www.dfwstonefabricators.com 作者:大发体育网络 人气:85 发布时间:2019-11-30
摘要:ios发送邮件 IOS 开垦,调用打电话,发短信,展开网站,ios发短信 1、调用 自带mail [[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"mailto://[email protected]"]];   2、调用 电话phone [[UIAppl

ios发送邮件

IOS 开垦,调用打电话,发短信,展开网站,ios发短信

1、调用 自带mail

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://[email protected]"]];

 

2、调用 电话phone

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8008808888"]];

 

3、调用 SMS

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888"]];

 

4、调用自带 浏览器 safari

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"];

 

调用phone可以传递号码,调用SMS 只好设定号码,不可能开头化SMS内容。

 

若供给传递内容能够做如下操作:

加入:MessageUI.framework

 

#import <MessageUI/MFMessageComposeViewController.h>

 

兑现代理:MFMessageComposeViewControllerDelegate

 

 

 

调用sendSMS函数

//内容,收件人列表

- (void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients

{

 

    MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];

 

    if([MFMessageComposeViewController canSendText])

 

    {

 

        controller.body = bodyOfMessage;   

 

        controller.recipients = recipients;

 

        controller.messageComposeDelegate = self;

 

        [self presentModalViewController:controller animated:YES];

 

    }   

 

}

 

// 管理发送完的响应结果

  • (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
    {
      [self dismissModalViewControllerAnimated:YES];
     
      if (result == MessageComposeResultCancelled)
        NSLog(@"Message cancelled")
      else if (result == MessageComposeResultSent)
        NSLog(@"Message sent")  
      else 
        NSLog(@"Message failed")  
    }

 

 

出殡邮件的为:

导入#import <MessageUI/MFMailComposeViewController.h>

实今世理:MFMailComposeViewControllerDelegate

 

//发送邮件

-(void)sendMail:(NSString *)subject content:(NSString *)content{

 

    MFMailComposeViewController *controller = [[[MFMailComposeViewController alloc] init] autorelease];

 

    if([MFMailComposeViewController canSendMail])

 

    {

 

        [controller setSubject:subject];

 

        [controller setMessageBody:content isHTML:NO];

 

        controller.mailComposeDelegate = self;

 

        [self presentModalViewController:controller animated:YES];

 

    }    

}

 

//邮件完结处理

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{

 

    [self dismissModalViewControllerAnimated:YES];

 

    if (result == MessageComposeResultCancelled)

        NSLog(@"Message cancelled");

    else if (result == MessageComposeResultSent)

        NSLog(@"Message sent"); 

    else 

        NSLog(@"Message failed");  

 

}

开采,调用打电话,发短信,张开网站,ios发短信 1、调用 自带mail [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://[email protected]

ios发送邮件

by 伍雪颖

第一种:

NSString *myEmail = @"[email protected]";
NSString *toemail = @"[email protected]";
NSString *emailDetail = [NSString stringWithFormat:@"mailto:%@?cc=%@&subject=Feedback!&body=Dear:",toemail,myEmail];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: emailDetail]];

第二种:

- (void)displayMailPicker {
    MFMailComposeViewController *mailPicker = [[MFMailComposeViewController alloc] init];
    mailPicker.mailComposeDelegate = self;
    [mailPicker setSubject: @"Feedback!"];
    NSArray *toRecipients = [NSArray arrayWithObject: @"[email protected]"];
    [mailPicker setToRecipients: toRecipients];
    NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]", nil];
    [mailPicker setCcRecipients:ccRecipients];

    // add a picture
    UIImage *addPic = [UIImage imageNamed: @"[email protected]"];
    NSData *imageData = UIImagePNGRepresentation(addPic);
    [mailPicker addAttachmentData: imageData mimeType: @"" fileName: @"Icon.png"];

    NSString *emailBody = @"Dear:";
    [mailPicker setMessageBody:emailBody isHTML:YES];
    [self presentViewController:mailPicker animated:YES completion:nil];
}

- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
    [self dismissViewControllerAnimated:YES completion:nil];
}

诚如用第三种

ios发送邮件 by 伍雪颖 第意气风发种: NSString *myEmail = @"[email protected]";NSString *toemail = @"[email protected]";NSString *emailDetail = [NSString stringW...

本文由大发体育娱乐在线发布于大发体育网络,转载请注明出处:张开网址,ios发送邮件

关键词:

上一篇:AJAX依据城市名

下一篇:没有了

最火资讯