简体   繁体   中英

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? 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.

I've searched around and only found this: http://macscripter.net/viewtopic.php?id=12463

Which can, via Applescript, give me the name of the default email client. Has anyone looked into this before?

Thank you.

You are correct. You'll have to implement different applescript code for each email client. 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. Of course you'll need to know the user's information (smtp server, username, etc). If you're interested you can see my python script here . It doesn't handle attachments but some google searching should show you how to modify it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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