text AppleScript Mail Send.scpt

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text AppleScript Mail Send.scpt相关的知识,希望对你有一定的参考价值。

tell application "Mail"
	
	set theFrom to ""
	set theTos to {}
	set theCcs to {}
	set theBccs to {}
	
	set theSubject to ""
	set theContent to ""
	set theSignature to ""
	set theAttachments to {}
	set theDelay to 1
	
	set theMessage to make new outgoing message with properties {sender:theFrom, subject:theSubject, content:theContent, visible:false}
	tell theMessage
		repeat with theTo in theTos
			make new recipient at end of to recipients with properties {address:theTo}
		end repeat
		repeat with theCc in theCcs
			make new cc recipient at end of cc recipients with properties {address:theCc}
		end repeat
		repeat with theBcc in theBccs
			make new bcc recipient at end of bcc recipients with properties {address:theBcc}
		end repeat
		repeat with theAttachment in theAttachments
			make new attachment with properties {file name:theAttachment as alias} at after last paragraph
			delay theDelay
		end repeat
	end tell
	
	# macOS 10.12+ know bug
	# https://stackoverflow.com/questions/39860859/setting-message-signature-of-outgoing-message-using-applescript
	# set message signature of theMessage to signature theSignature
	
	send theMessage
	
end tell

以上是关于text AppleScript Mail Send.scpt的主要内容,如果未能解决你的问题,请参考以下文章

如何在Mail.app中运行的applescript中使用钥匙串中的密码?

AppleScript从Mail.app上的Imap文件夹中选择消息

用Ruby和rb-appscript代替Applescript发送苹果邮件

无法在“邮件”应用程序中执行 AppleScript

使用applescript创建并发送电子邮件

从导入笔记邮件.app进入Evernote(Applescript)