【问题标题】:Send a text as email with receiver (me) already inserted?将文本作为电子邮件发送,接收者(我)已经插入?
【发布时间】:2017-04-07 16:04:40
【问题描述】:
我想让我的用户通过在文本字段中输入一些文本并提交它来向我发送改进建议(希望就是这个词)。该过程应如下所示:
- 您点击“改进建议”按钮
- 正在打开带有文本字段的 UIAlert
- 您输入文本并点击提交
- 正在打开一封新电子邮件,并将我的电子邮件地址插入为收件人
我该怎么做?嗯,我已经掌握了第 1 步到第 3 步,只是第 4 步是我遇到问题的地方。
这真的可能吗?如果可以,怎么做?
【问题讨论】:
标签:
ios
email
swift3
uialertcontroller
【解决方案1】:
使用MFMailComposeViewController 绝对可以做到这一点。
然后就可以写了
let composeVC = MFMailComposeViewController()
//...further setup...
composeVC.setMessageBody("This is my proposal:", isHTML: false)
composeVC.setToRecipients(["myadress@example.com"])
self.presentViewController(composeVC, animated: true, completion: nil)