我是 Mac OS X 应用程序开发的新手,我的问题很简单,我可以通过我的应用程序在默认邮件应用程序中设置收件人和正文文本,但我无法在邮件应用程序中设置抄送和密件抄送收件人。有没有办法通过代码设置CC和BCC,我正在使用Swift。
我的设置收件人和正文的代码在这里
service!.recipients = [self.txtTo.stringValue]
service!.subject = "Subject"
Thanks
对于这种情况,通常使用 mailto URL 会容易得多 - 所有邮件应用程序都支持它们(并且需要将其作为应用程序注册为电子邮件应用程序的 URL 方案)。
这是schema https://yoast.com/dev-blog/guide-mailto-links/.
一个例子是:
mailto:[email protected] /cdn-cgi/l/email-protection?subject=blah&[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection&[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection
您可以使用以下命令生成并打开此 URL
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"mailto:[email protected] /cdn-cgi/l/email-protection?subject=blah&[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection&[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection"]]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)