跳至内容

AppleScript 编程/示例程序/存档已选择的邮件

来自 WikiBooks,开放世界的开放书籍

据说该脚本告诉 Mail.app 将所选邮件移动到某个目录/邮箱中。应该可以与 Gmail 配合使用,但不是通用脚本。除非该脚本的所有内容均已配置,否则该脚本无法工作。

(* This script is commented out because it needs work.
tell application "Mail"
	set selectedMails to the selection
	if the length of selectedMails is greater than 0 then
		repeat with theMessage in selectedMails
			if the name of the mailbox of theMessage is "INBOX" then
				-- Set "gmail" to whatever your account is called in Mail.app's preferences
				if the account of the mailbox of theMessage is account "gmail" then
					-- Note: instead of "All Mail" below, I had to use "[Gmail]/All Mail" -Simon, using Mail 3.5 (930.3) & Gmail w/ IMAP
					move theMessage to mailbox "All Mail" in account "gmail"
				-- Add custom accounts with custom names and custom archive mailboxes here
				-- else if the account of the mailbox of theMessage is account "uni" then
				--	move theMessage to mailbox "Archive" in account "uni"
				else
					say "Your mail didn't belong to any account I know."
				end if
			else
				say "Only mails in inbox can be moved"
			end if
		end repeat
	else
		say "You have to select mails first"
	end if
end tell
*)
华夏公益教科书