1

我正在使用此代码单击按钮发送电子邮件:

   -(IBAction)btn_emailClick:(id)sender{
       // checking for the blank Email id field.
       if ([[patientDemogDic valueForKey:@"email"]  isEqualToString:@""]){

       }
       else{

           if([MFMailComposeViewController canSendMail]){

               MFMailComposeViewController * mailer = [[MFMailComposeViewController alloc] init];
               mailer.mailComposeDelegate = self;
               [mailer setSubject:@""];
               NSArray * toRecipients = [NSArray arrayWithObjects:[btn_emailClick currentTitle],
               nil];
               [mailer setToRecipients:toRecipients];
               NSString *emailBody = @"";
               [mailer setMessageBody:emailBody isHTML:NO];
               mailer.navigationBar.barStyle = UIBarStyleBlackOpaque;
               [self presentViewController:mailer animated:YES completion:Nil];
           }
           else{

               UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failure" message:@"Your
               device doesn't support the composer sheet" delegate:self 
               cancelButtonTitle:@"OK"otherButtonTitles:nil];
               [alert show];
           }
       }
   }

一切正常,但只要电子邮件地址是这样的:- nupur_Pal.iwalMeditab,.<>{}[]!#$%^&*_@meditab.com 电子邮件编辑器屏幕中的“收件人”字段是不显示此电子邮件地址。我已经调试了好几次,但找不到正确的原因。

4

1 回答 1

1

制作IBOutlet电子邮件UIButton

并尝试以下代码

   NSArray * toRecipients = [NSArray arrayWithObjects:emailButton.titleLabel.text,
    nil];
    [mailer setToRecipients:toRecipients];
于 2013-05-08T09:52:55.550 回答