用Ruby和rb-appscript代替Applescript发送苹果邮件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用Ruby和rb-appscript代替Applescript发送苹果邮件相关的知识,希望对你有一定的参考价值。
require "appscript" include Appscript def send_email(subject, content, *addresses) mail = app('Mail') msg = mail.outgoing_messages.end.make(:new => :outgoing_message) # mail.set(msg.visible, :to => true) # by default, mail.set(msg.subject, :to => subject) mail.set(msg.content, :to => content) # mail.set(msg.sender, :to => "[email protected]") # otherwise default email address used addresses.each do |addr| msg.to_recipients.end.make(:new => :to_recipient, :with_properties => {:address => addr}) end msg.send_ end # send_email("subject goes here", "Hello Cruel World!", "[email protected]") # => true
以上是关于用Ruby和rb-appscript代替Applescript发送苹果邮件的主要内容,如果未能解决你的问题,请参考以下文章
markdown 使用ruby代替grep / awk / sed就像perl一样
在 Apple Silicon M1 上使用 Ruby 3.0.2 在 MacOS Monterey 上安装 sqlite3 时出错