MFMailComposeViewController 更改收件人
您好,我想让用户能够将电子邮件发送到不同的电子邮件地址,这取决于表视图中选择的回合 - 全部来自同一视图。 我的问题是每次我尝试一些操作时都会更改收件人的电子邮件地址,例如将电子邮件地址放入字符串中,该字符串会根据按下的按钮进行更新,但我无法将电子邮件地址获取到to:作曲家中的选项卡。 我能够修复特定的电子邮件地址,但我希望每次收件人不同时“收件人:”选项卡都会更改。 任何帮助将不胜感激 - 我当前返回空白电子邮件地址的代码如下。 (邮件是我每次收到正确电子邮件地址的字符串)。
-(void)displayComposerSheet
{
MFMailComposeViewController *mailComposerVC = [[MFMailComposeViewController alloc] init];
mailComposerVC.mailComposeDelegate = self;
[mailComposerVC setSubject:@"Iphone App"];
NSArray *toRecipients = [NSArray arrayWithContentsOfFile:mail];
[mailComposerVC setToRecipients:toRecipients];
NSString *BodyText = @"My Name Is: \n My Phone Number Is: \n Please Help With: \n";
[mailComposerVC setMessageBody:BodyText isHTML:NO];
[self presentModalViewController:mailComposerVC animated:YES];
}
Hi I would like to enable the user to send e-mail to different e-mail address it depends on the bout ton selected in the table view - All from same view.
My problem is changing the e-mail address of the recipient each time i tried a few things like putting the e-mail address in a String which updates depending on the bout ton pressed but i was not able to get the e-mail address to the to: Tab in the composer.
I am able to fix a spesific e-mail address but i want the to: tab to change each time it is a different recipient.
Any help would be appreciated -
My current code which returns blank e-mail address is below.
(Mail is my String receiving the correct e-mail address each time).
-(void)displayComposerSheet
{
MFMailComposeViewController *mailComposerVC = [[MFMailComposeViewController alloc] init];
mailComposerVC.mailComposeDelegate = self;
[mailComposerVC setSubject:@"Iphone App"];
NSArray *toRecipients = [NSArray arrayWithContentsOfFile:mail];
[mailComposerVC setToRecipients:toRecipients];
NSString *BodyText = @"My Name Is: \n My Phone Number Is: \n Please Help With: \n";
[mailComposerVC setMessageBody:BodyText isHTML:NO];
[self presentModalViewController:mailComposerVC animated:YES];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的收件人是什么?
你为什么不这样做:
What is your toRecipients?
Why don't you just do: