请选择 进入手机版 | 继续访问电脑版

苹果发烧友论坛

 找回密码
 注册
查看: 7405|回复: 10

[程序] 应用规则,发挥mail巨大潜力

[复制链接]
发表于 2010-5-14 22:37:34 | 显示全部楼层 |阅读模式
应用规则,发挥mail巨大潜力


作者:未知    翻译:macing2010


       Mail的最霸道的特性当中有一个是最不起眼,也是潜力挖掘得最少的。这个特性叫“规则”,可以在Mail的偏好设置里找到。规则基本上允许你告诉Mail在特定事情发生后要做什么——在文件夹之间移动邮件,添加色彩标记,或者自动发送回复邮件。
       这里,我将解释规则可以做什么,怎样使用规则才能发挥Mail的巨大潜力。文章中也会使用一些新奇的例子,包括通过发送一个简单邮件让你的电脑睡眠的功能。

机器人变形(开始)
      如果Mail没有事先打开就激活一下(打开),然后到菜单栏打开偏好设置,或者按下键盘快捷键“⌘ + ,”。在弹出的偏好设置窗口,你将看到规则是在右边的最后一项。点击,然后窗口就变到跟下面的类似了:
starting_rules.png
创建规则
       要在Mail里添加一个新规则,直接点击设置窗口里“添加规则”按钮。一个新窗口就滑下来,显示可输入内容的特性设置。
       在这个例子里,我会向你演示怎样管理好你的邮件。这样在你收到一封来自苹果、Facebook或者其他公司的邮件时,可以直接邮寄到一个跟私人或工作邮件分离的文件夹。
adding_rule.jpg
       上面的“描述”是这个规则的名字,一遍以后方便查询。在这个案例中,我们可以给规则取名为“Apple”或者其他类似的名字。一般当“所有”或者“任一”一个你输入的条件符合,Mail就会执行任何你预置的操作。

设置规则
       现在,因为我们想移动来自苹果的信息,所以在第一个下拉菜单(除了上面任一/所有菜单)里选“发件人”。苹果有许多不同的邮件地址,所以要独立指定它们可能不太现实。但是呢他们的所有地址中都包含有“Apple”!所以有了这样的分析以后,我们可以轻松地从第二个下拉菜单中选定“包含”,然后后面的输入栏填入“apple”。
       基于这样的信息,Mail会从寄件人里搜索地址中包含“apple”的邮件。如果你想应用到其他公司的邮件上,点击右面的圆圈“+”按钮,然后再输入和要求的关键字,比如“Facebook”。
       如果你注意第一个下拉菜单下面的“就执行下列操作:”,你就会发现你能做许多事情。但是现在,只要选择“移动邮件”就行了。
       至此,因为我们还没有创建一个地方来放置这些商业邮件,得临时创建一个。返回Mail主界面,然后在最最最左下角有个“+”。点击,选择“新建邮箱”,位置为“在我的Mac上”,然后输入邮箱的名字。我命名为“Apple”。
newmailbox.png
       完成后,点击“好”按钮后返回到你的新规则设置窗口。现在,在“到邮箱:”后面你就可以在下拉菜单里找到新邮箱“Apple”了。根据你使用的Mail版本的不同,这个可能隐藏在文件夹“在我的Mac上”下面。完成后,点击“好”来保存你的规则。
ruledetails.jpg
       你现在应该发现所有Apple已经发送和将要发送的电子邮件都自动移动到新的文件夹里,跟其他邮件分开了。

Tip:
      有些人疑惑“为什么不用智能邮箱呢”?嗯,原因是智能邮箱只是在智能邮箱里显示确切的邮件。它并不能把邮件从一处挪到另一处。而规则在你想要把商业邮件跟私人邮件区分开的时候非常有用。况且,我上面举的例子只是帮助那些没有经验的用户理解规则在Mail中是如何工作的,然后他们才能自如的发挥他们自己的想法。


其他用处:
      当然了,移动文件从一个文件夹到另一个文件夹只是应用的冰山一角,其他有很多事情可以用规则来做。这里列举了我发现的一些比较好的应用:
设置邮件颜色
       这个规则非常棒,你可以用颜色标记来自某个确切的人的邮件。我自己的邮箱就作了这样的设置,这样我的朋友给我来信时就会黄色高亮显示。我看信的时候就得到提醒了。这个选项可以通过选择操作下的“设置油件颜色”来实现。

声音警告:

      我要提的另一件事是我网站有个评论区。每次有人发给我评论的时候,评论都会以主题为“评论”的邮件发送到我的邮箱里。所以在Mail的规则里,有一条是我设置了来朗读“你收到一则评论”的一段事先录制好的音频剪辑。而且,这个规则也灰常整洁有序。

遥控电脑睡眠:

       这是一个应用苹果脚本跟规则配合做事的绝好想法。当时你正好已经到公司了,然后突然想起来你的电脑还没关。不要担心,只要你发一封主题类似“丫头,快去睡觉”的邮件到你的电脑,然后电脑就自动自觉的去睡觉了。下面是做法:
打开位于应用程序文件夹下的脚本编辑器,在里面输入:
  1. tell application “Finder” to sleep
复制代码
到文件——保存为……脚本命名为“丫头,快去睡觉”文件格式为“脚本”,选定保存位置后点击“保存”。在Mail里新建一个规则,按我下面的图填写就行了(脚本的位置跟我的不同):
屏幕快照 2010-05-14 下午10.02.26.jpg
      从此以后,每当你发送给你一封主题为“丫头,快去睡觉”的邮件,你的电脑就会立马进入睡眠状态了。

自动回复:
      嗯,你经常度假?那就新建另一则操作为“回复邮件”的规则。输入回复邮件文本,然后任何符合你所设置的条件的人就会自动收到你的回复了。如果你经营着生意,也需要自动发送回复邮件给那些咨询相关事宜的人,这就灰常有用了。

总结
      规则是Mail里经常被忽略却极嚣张的特性。我建立了各种各样的规则,它们在更友好的使用Mail上做出了巨大贡献。研究是必须的,在你掌握了基本知识后,Mail使用起来将变得非常简单。
      如果你熟悉AppleScript,那在回应一封邮件上就有无穷无尽的操作了。每次收到邮件后朗读寄件人姓名、拍摄一张电脑所在房间的照片看是否遭窃、或者远程注销你的电脑。潜能无限了。

评分

参与人数 1威望 +40 收起 理由
luki + 40 我很赞同

查看全部评分

 楼主| 发表于 2010-5-14 22:46:49 | 显示全部楼层
原帖:http://mac.appstorm.net/how-to/i ... with-rules-in-mail/   

Working With Rules in Mail

Author:Unknown

One of Mail’s most powerful features is not immediately obvious, and rarely used to it’s full potential. This feature is called “rules” and can be found hidden within the application’s preferences. Rules basically allow you to tell Mail what to do when certain things happen – moving email between folders, adding colours, or automatically sending a response.
Here, I will explain what rules are capable of, and how do use them to make the most of your email client. The article will also outline a few novel examples, including the ability to send your computer to sleep via a simple email.
Getting Started
Fire up Mail if it isn’t already open, and then in the Menu bar, go: Mail -> Preferences, or hit in the keyboard short-cut, ⌘ + ,. In the Preferences window that pops up, you’ll see that rules is the last item on the far right. Click on this, and the window will change to one resembling the following:

Opening Rules
Setting up a Rule
To add a new rule in Mail, simply click the ‘Add Rule’ button in the preferences window. A new window will slide out to reveal a set of characteristics that you can input.
For this exercise, I’ll show you how to manage your emails so that when you receive an email from Apple, Facebook, or any other company, you can direct these into a separate folder away from your personal or work emails.

Adding a New Rule
The description is the name of the rule, so that you can refer back to it easily later on. In this case, we can name our rule “Apple” or something similar. Basically when ‘all’ or ‘any’ of conditions that you input are met, Mail will perform whatever action you ask it to.
Configuring a Rule
Now, because we want to move messages that come from Apple, in the first pull down menu (apart from the any/all one at the top) choose “From”. Apple have many different email addresses, and specifying each of them individually wouldn’t be practical. However, all of their addresses do have the word “apple” in them! With this knowledge, we can simply choose ‘Contains’ from the second pull down menu, and in the text field next to it, type in the text: “apple”.
With this information, Mail will search for emails from a sender with the word ‘apple’ in the address. If we want to do the same for other companies, click on the circular ‘plus’ button to the right of the text field you just typed in, and enter the required text, such as “facebook”.
If you have a look at the first pull down menu below “Perform the following actions:”, you’ll see that there is quite a range of things you can do. For now though, just choose “Move Message”.
Now, because we haven’t yet created a place to move these commercial messages to, we will do that now. Go back to your inbox in Mail, and down the very bottom left corner is a plus sign. Click on it, and choose ‘New Mailbox…’ Leave the ‘Location’ as ‘On My Mac’, and then enter a name for this mailbox. I’ve named mine “Apple.”

Creating a Mailbox
Once done, hit the ‘OK’ button and go back to your new rule in the preferences window. Now, after the words ‘to mailbox:’ you should be able to find your new mailbox ‘Apple’ in the pull down menu. Depending on which version of Mail you’re using, this may be hidden in the folder ‘On My Mac.’ Now you’re done! Hit the OK button to save your rule.

Entering Rule Details
You should now find that all of the emails that Apple has sent you, and will send you in the future automatically are moved to this new folder, separate from all of your other emails.
Some of you may be wondering “why not just use Smart Groups”? Well, the reason for this is because Smart Groups only displays specific emails in these ‘groups’. It doesn’t actually move messages from one location to another, which is useful when you want to separate commercial messages from personal ones. Also, this example I have provided above is mostly to help inexperienced users understand how Rules in Mail work, so that they can begin experimenting with other ideas themselves.

Other Uses
Of course, moving and organising items from one folder to another is just the tip of the iceberg, and there’s a huge amount more that can be done with rules. Here are a selection of some the best uses that I’ve found:
Colour Coding Messages:
A great rule that you can set up under the action is to colour code emails from specific people. I’ve set my Mail to do this so that when one of my friends sends me an email it appears highlighted orange, notifying me at a quick glance. This option can be found via ‘Set Color of Message’ under the actions.
Sound Alerts:
Another thing that I had going a while back, was that I had a comments section of my website. Every time someone sent me a comment, it went to my home email address with the subject as ‘Comment.’ In Mail’s rules, I set it up to play a pre-recorded audio clip of the computer announcing that “You have received a comment.” This is also pretty neat.
Remote Sleep:
Here’s a very clever idea of the sort of thing that you can do when you use a bit of scripting. Say you just arrived at work, and then realised that you left your home computer turned on. Not to worry, just send an email to your home computer with the subject as “Go to sleep”, and the computer will do it automatically. Here’s how…
Open up Script Editor, which can be located under AppleScript in your Applications folder. In Script Editor, type:
tell application “Finder” to sleep
Go File -> Save As… Name your script as “Go to sleep”. File Format should be left as Script, so choose a location and hit ‘Save’. In Mail, make a new rule, and fill it in as I’ve done in the image below (the location of your script may be in a different location to mine):

Email Your Mac to Sleep
From now on, whenever you send yourself and email with “Go to sleep” as the subject, your computer will go to sleep immediately.
Auto Reply:
Away on holiday? Just make yourself another rule with the action set to ‘Reply to Message’. Now just type a message and whoever you’ve set as the conditions will receive your automatic response. This could also be very useful if you’re running a business and want to send out automatic emails to those who enquire about something.
Conclusion
Rules in Mail are an incredibly powerful feature, often overlooked. I have various rules set up, which all contribute to making Mail more friendly. They are certainly worth looking into, and very simple to use after you’ve mastered the basics.
If you’re familiar with AppleScript, there are endless possibilities for actions which can be created in response to an email; announce the name of who sent you a message every time you receive an email, take a photograph of the home computer’s room to check for burglars, or log out of the computer remotely. The possibilities are endless!
回复 支持 反对

使用道具 举报

发表于 2010-5-18 00:40:14 | 显示全部楼层
哥们这个工程浩大!向你学习!
回复 支持 反对

使用道具 举报

发表于 2010-5-18 12:23:07 | 显示全部楼层
支持LZ翻好文,Mail这个可以出系列教程了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-5-18 12:28:40 | 显示全部楼层
回复 3# roy120981387


    谢谢。翻译组的哥哥、姐姐、叔叔、阿姨们都很辛苦,值得学习。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-5-18 12:32:26 | 显示全部楼层
回复 4# ccasd


    这些用起来都不是很难,关键是好点子和好脚本。
回复 支持 反对

使用道具 举报

发表于 2010-5-18 13:48:53 | 显示全部楼层
我一直很想给这篇加精的,可是一直没时间读完,未认真读的东西,不能做这么高评价。先欠这吧。。。。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-5-18 18:25:25 | 显示全部楼层
回复 7# la.onger


    哈哈,等待版主。
回复 支持 反对

使用道具 举报

发表于 2011-3-30 12:28:05 | 显示全部楼层
"打开位于应用程序文件夹下的脚本编辑器"

请问脚本编辑器是什么
回复 支持 反对

使用道具 举报

ethan8761 该用户已被删除
发表于 2011-4-1 16:13:20 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

QQ|小黑屋|手机版|Archiver|苹果发烧友论坛 ( 京ICP备16012027号-3 )

GMT+8, 2017-10-23 02:56 , Processed in 0.017156 second(s), 12 queries , Xcache On.

Powered by Discuz! X3.3 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表