Apple Mail
Content
Rules
The action "Stop evaluating rules"Examples for rules
Change the color of a message
Move messages with invoices from service providersSearch in entire messages
Move junk messages
Mark messages with PDFs or documents
Rules
Rules can be used to execute various actions for incoming messages. This is also possible for messages that are already in the inbox if the rules are executed manually.
The rules can be defined in the settings under "Rules". The rules are processed from top to bottom. The order of the individual rules is therefore important. Rules can be moved up or down in the list using drag & drop. The checkbox in front of each rule can be used to activate or deactivate it.
Each rule begins with a freely chosen description, followed by one or more conditions and one or more actions.
Above the conditions, a selection determines whether all conditions must be fulfilled or just one.
Each condition starts with a selection list with header fields or the data origin, such as the sender, the subject or whether the message contains a specific attachment.
At the end of the list is the entry "Edit header list". If this is selected, a new window appears in which a user-defined header - without a colon - can be added. This is useful for searching for less common headers.
Depending on the selected data source, further selection fields or text fields are displayed in which additional settings can be made.
The actions to be executed follow under the conditions. These are also defined with selection fields, text fields and other control elements - depending on the action selected.
At the end of the list, the “Stop evaluating rules” action can be used to prevent further rules from being processed.
The action "Stop evaluating rules"
The "Stop evaluating rules" action means that no further rules are applied to this message if the message remains in the inbox. This action can prevent the message from being deleted or moved to the junk folder by subsequent rules. If the message is moved from the inbox to another folder, this action is not required.
Change the color of a message
The text color and background color of messages can be changed with a rule. This is done with the "Set Color of Message" action. A message can also be manually assigned a background color via the "Format" > "Show Colors" menu. As resetting to the standard system colors is somewhat tedious, the coloring of messages should be carefully considered.
Resetting to the default colors is possible via the "Format" > "Show Colors" menu and then via the "Color Palettes" button and the "Developer" selection. The color “disabledControlTextColor” for the text color and “alternatingContentBackgroundColor” for the background color must be dragged & dropped onto the messages or assigned by rule.
Examples for rules
Mit den bereits enthaltenen Bedingungen können unter anderem Nachrichten, die den eigenen Namen enthalten ("Message is addressed to my full name") oder Nachrichten von Personen, die in den Kontakten stehen ("Sender is in my contacts") ausgewählt werden. Ebenso, ob eine Nachricht signiert, verschlüsselt oder Junk ist, eine bestimmte Priorität oder einen bestimmten Absender hat.
Move messages with invoices from service providers
You don't want to overlook important messages from your own online provider or other service providers and perhaps file them separately. The following rule moves messages based on the sender addresses ("From”) to a separate folder with the name "Service". This rule should be sorted before rules that delete messages, mark them as junk or move them to another folder.
Messages with notifications, such as newsletters, changes to terms and conditions or mentions in a post, can also be moved to another folder in the same way.
Move junk messages
Junk messages should be recognized automatically or filtered using suitable methods. However, sometimes you receive advertising messages from senders who usually send desired messages. You can use a rule to find messages with certain senders or subjects and move them to the junk folder. Finally, the message can also be marked as read.
Mark messages with PDFs or documents
Messages with invoices, business documents or contracts usually contain these as attachments in the form of PDF files. A rule can be used to mark such important messages with a flag, for example.
This requires two conditions with "Attachment type". One must be set to "PDF" and the other can be set to "Document". For example, the message can be flagged with an action. This is done with "Mark as Flagged" and a color of your choice. At the end, the action "Stop evaluating rules" must be inserted.
Search in entire messages
In Apple Mail, you can only search in the message text and a few header lines. Especially in headers such as the Received lines or the lines beginning with “X-”, no search is possible via the Apple Mail GUI.
However, an AppleScript can be used to instruct Apple Mail to search for a specific text in the entire original mail, including all headers.
The following script searches all selected messages for a user-defined text. Messages that contain the search term are marked with a colored flag.
Here is the exact procedure:
- Open Apple Mail and select all messages to be searched.
- Run the “Script Editor” application, e.g. with Spotlight using ⌘ Cmd+␣ Space and enter “Script Editor”.
- Insert the following code and execute it using the "Play" icon in the toolbar. The script can also be saved as a file so that it can be loaded and executed again at a later time.
AppleScript-- Prompt the user for a custom search string set findString to text returned of (display dialog "Enter the text to search for (including message header):" with title "Full Message Search" default answer "") -- Prompt the user for a custom flag (1-7, -1 = remove the flag) set customFlag to text returned of (display dialog "Enter a flag (0-6):" with title "Full Message Search" default answer "6") tell application "Mail" -- Get all messages in the mailbox set theMessages to selection repeat with aMessage in theMessages -- Get the raw source of the message set messageSource to source of aMessage -- Check if the custom header is in the source (adjust the header name and value as needed) if messageSource contains findString then -- Set message flag set flagged status of aMessage to true -- display (true) or hide (false) flag set flag index of aMessage to customFlag -- set color for the flag (0-6 or -1 for none) end if end repeat end tell
- After starting the script, you are asked for the text to be searched for. It then asks for the index number of the flag, which must be between 0 and 6. The default value is 6 for a gray flag.
Once the search is complete, the messages found can be viewed in the Flagged folder under Favorites (Favorites / Flagged).
Did you like my page, one of my freeware applications or online tools?
Then, please donate via PayPal in order to help keeping its content free - each amount is welcome!