问题描述
限时送ChatGPT账号..我对这个问题进行了大量研究,但似乎无法为我的问题找到可靠的解决方案.
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.
我正在开发一个 Java 客户端应用程序,它(应该)允许用户通过以列表格式获取联系人并允许用户选择一个子集/全部并单击将发送邀请"给这些用户.
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.
我能够使用 Rococoa Java 框架获取联系人,但我不确定如何发送电子邮件,或者是否可能.我意识到这存在安全问题,但我能够在 Outlook for PC 上完成同样的任务.
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.
似乎我可能需要从我的 Java 调用 Applescript,手动打开 Mac 邮件客户端并使用他们的默认邮件帐户设置发送电子邮件.
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.
马特推荐答案
这是一个使用邮件的小程序...
Here's an applescript to use Mail...
set emailSender to "sender@email>"
set emailTo to "recipient@email"
set theSubject to "The subject of the mail"
set theContent to "message body"
tell application "Mail"
set newMessage to make new outgoing message with properties {sender:emailSender, subject:theSubject, content:theContent, visible:true}
tell newMessage
make new to recipient at end of to recipients with properties {address:emailTo}
send
end tell
end tell
如果你知道smtp信息,另一个选择是使用python.我做了一个你可以使用的命令行程序.在此处找到它.有示例代码可以在网页上使用它.
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.
这篇关于在 Mac 上使用 Java 以编程方式发送电子邮件(通过 Mac 邮件客户端)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论