【问题标题】:how to set recipient in Email IOS如何在电子邮件 IOS 中设置收件人
【发布时间】:2013-03-30 13:31:47
【问题描述】:

这是我在点击时用来发送邮件的内容

- (IBAction)email:(id)sender {
    if ([MFMailComposeViewController canSendMail]) {

        MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
        mailViewController.mailComposeDelegate = self;
        [mailViewController setSubject:@"Subject Goes Here."];

         [mailViewController setMessageBody:@"Your message goes here." isHTML:NO];

          [self presentModalViewController:mailViewController animated:YES];
          [mailViewController release];


          }

          else {

              NSLog(@"Device is unable to send email in its current state.");

          }

现在当我点击它时有邮件按钮,然后该视图出现用于撰写邮件 所以在按钮旁边有一个名为 _emailTextField 的文本字段,所以我想要的是当单击按钮时,该文本字段应该出现在撰写邮件视图中,就像在文本字段中有 hell@yahoo.com 然后在 TO 的 mailview 中它应该是 hell@yahoo作为收件人

请告诉我该怎么做?

【问题讨论】:

标签: ios email


【解决方案1】:

你可以使用:

[mailViewController setToRecipients:[NSArray arrayWithObject: _emailTextField.text,nil]];

【讨论】:

    【解决方案2】:
      NSArray *recipentsArray = [[NSArray alloc]initWithObjects:@"xxx@gmail.com", nil];
     [mailViewController setToRecipients:recipentsArray];
    

    【讨论】:

      【解决方案3】:
      mailViewController.recipients = [NSArray arrayWithObjects:@"abc@xyz.com",nil];
      

      【讨论】:

        猜你喜欢
        • 2016-10-04
        • 1970-01-01
        • 2014-05-24
        • 2018-04-09
        • 2020-02-14
        • 2016-04-05
        • 1970-01-01
        • 1970-01-01
        • 2015-02-11
        相关资源
        最近更新 更多