简体   繁体   English

使用AppleScript通过默认电子邮件客户端发送邮件附件

[英]Using AppleScript to send mail attachment through default email client

Is it possible in any way to send an email attachment through the user's default email client using AppleScript? 是否可以通过任何方式使用AppleScript通过用户的默认电子邮件客户端发送电子邮件附件? I'm assuming there is no easy way of doing this, as the programs themselves have to implement AppleScript and every email client will implement it differently and require a different script for sending an email with an attachment. 我假设没有简单的方法来执行此操作,因为程序本身必须实现AppleScript,并且每个电子邮件客户端将以不同的方式实现它,并且需要使用不同的脚本来发送带有附件的电子邮件。

I've searched around and only found this: http://macscripter.net/viewtopic.php?id=12463 我四处搜寻,只发现了这个: http : //macscripter.net/viewtopic.php?id=12463

Which can, via Applescript, give me the name of the default email client. 可以通过Applescript为我提供默认电子邮件客户端的名称。 Has anyone looked into this before? 以前有人看过吗?

Thank you. 谢谢。

You are correct. 你是对的。 You'll have to implement different applescript code for each email client. 您必须为每个电子邮件客户端实现不同的applescript代码。 As such you'll probably want to limit the email clients your application will support and make that clear to your users. 因此,您可能希望限制应用程序将支持的电子邮件客户端,并向用户明确说明。

The only other way for it to work universally is for you to implement your own email system. 通用性的唯一其他方法是您实施自己的电子邮件系统。 I have a python script that I can call from an applescript using "do shell script" to send emails. 我有一个python脚本,可以使用“ do shell脚本”从applescript调用以发送电子邮件。 Of course you'll need to know the user's information (smtp server, username, etc). 当然,您需要知道用户的信息(smtp服务器,用户名等)。 If you're interested you can see my python script here . 如果您有兴趣,可以在这里查看我的python脚本。 It doesn't handle attachments but some google searching should show you how to modify it. 它不处理附件,但是一些Google搜索应该向您展示如何进行修改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM