使用 Java 在 Mac 上以编程方式发送电子邮件(通过 Mac 邮件客户端)
我对这个问题做了很多研究,但似乎无法为我的问题提出可靠的解决方案。
我正在开发一个 Java 客户端应用程序,它(应该)允许用户从 Mac 地址簿中导入联系人,方法是以列表格式获取联系人,并允许用户选择一个子集/全部,然后单击一个按钮,将“邀请”发送到这些用户。
我能够使用 Rococoa Java 框架获取联系人,但我不确定如何发送电子邮件或者是否可能。我意识到这存在安全问题,但我能够在 Outlook for PC 上完成相同的任务。
看来我可能必须从 Java 调用 Applescript,手动打开 Mac 邮件客户端并使用其默认邮件帐户设置发送电子邮件。
我可能完全偏离了基地...我是否应该通过用户的默认邮件帐户发送邮件?我想避免使用不同的邮件服务器以避免垃圾邮件等。
任何帮助将不胜感激,感谢您的宝贵时间。
- 马特
I've done quite a bit of research on this matter and I can't seem to come up with a solid solution to my problem.
I am developing a Java client application that (should) allow users to import their contacts from Mac Address Book by fetching them in a list format and allowing the user to select a subset/all and click a button that would send an "invitation" to these users.
I was able to grab contacts using the Rococoa Java framework but I am uncertain as to how to send email or if it is even possible. I realize there are security concerns with this, but I was able to accomplish this same task on Outlook for PC.
It seems that I may have to call an Applescript from my Java that manually opens Mac Mail Client and sends email using their default mail account setup.
I could be totally off-base here... should I even bother sending mail through the user's default Mail account? I wanted to avoid using a different mail server to avoid spam etc.
Any help would be appreciated, thank you for your time.
- Matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个使用 Mail 的 applescript...
如果您知道 smtp 信息,另一个选择是使用 python。我制作了一个你可以使用的命令行程序。在此处找到它。有在网页上使用它的示例代码。
Here's an applescript to use Mail...
Another option, if you know the smtp information, is to use python. I made a command line program you can use. Find it here. There's example code to use it on the web page.