ANNOUNCE: Mail.app Scripting Book with AppleScript

I wrote new ebook about all of Mail.app’s AppleScript (in Japanese). This is my #70 th ebook in this series.
PDF 369 pages.

This book introduces how to get and send detailed email information, send files as attachments, visualize and display email threads in a mind map style, and send using SendGrid’s high-speed email delivery service via REST API. This book introduces a wide range of practical email-related AppleScript know-how.

■■ Contents(Translated by Google)

■ Elementary

start the script editor
“Start the script editor!”
Script editor help
“Let’s change the color settings!”
"Let’s enter the script
"Let’s save the script
Let’s run the script (1/2)
Run the script (2/2)
Security and privacy
Privacy and security (13.x and later)
Security and Privacy > Privacy
Privacy and security (macOS 13)

Start Mail.app
Specify email (Mail.app)
Start the mail.app
Exit Mail.app
How to look up the Mail.app AppleScript terminology dictionary
How to check menu items and forced screen operations
About the detailed specifications of Mail.app

Let’s get the information of Mail.app
Get the name of the mail.app
Email.app version is obtained
Mail.app property items and contents (1/2)
Mail.app property items and contents (2/2)

Selected mailbox, get mail
selected mainboxes = selected mailboxes
selected messages = selected emails
selection = get selected messages
Mailbox property items and contents

Get email information
Get the contents of the message (email)
Obtain the source of the message (email)
Acquiring various information about messages (emails)
Message property items and contents
Message property items and contents
Message property items and contents

Extraction of emails that meet the conditions
Acquire messages that meet the conditions

Email account information
Multiple email accounts are possible
Acquire detailed information of the account object
Account property items and contents (1)
Account property items and contents ②

retrieve email address
Extract the email address and name from the character string
Extract the email address and name from the selected message

signature
Manage “signature” in Settings > Signature
Acquire information from the signature
Signature information during application selection
Rewrite the attribute value of the signature (name, text)

Operations from the script menu
Operation from the script menu ①
Operation from the script menu ②
Operation ③ from the script menu

print out
Print output from Mail.app (GUI side)
Printing by AppleScript
Printing by AppleScript (GUI Scripting)

■ Intermediate

Check for new mail by specifying an account
Email confirmation for each email account type
Setting/stopping the new mail confirmation schedule

SMTP server
Acquisition of SMTP server information
Switch SMTP server settings for the specified account
SMTP server property items and contents

Compose new email
Creating a new message

send e-mail
Create a new message + send
Sending emails created on the GUI side (1)
Sending emails created on the GUI side ②

Send email with attachment
Create a new message + attach a file + send
Create a new message + attach an archive file + send (1)
Create a new message + attach an archive file + send ②

Handle email attachments
Save the selected email attachment
Aggregate the types of attachments of the selected email ①
Aggregate the types of attachments of the selected email ②
If the selected email has an attachment, change the background color to red

Email reply
Reply to the selected email ①
Reply to the selected email ②

Mail forwarding (Forward)
Forwarding the selected email (forward) ①
Forwarding to the selected email ②

email redirection
Non-destructive transfer (redirect) of the selected mail (1)

Access to mailbox
Special mailbox object
Access to special mailboxes
Access to a special mailbox for each account

Mail folder path information
Mailbox path notation
Get the full path of the selected mailbox
Specify a mailbox with a full path string

Move between email folders
E-mail specification ①
Specify email ②
a copy of the email
E-mail movement

Operating the viewer window
Mail.app window type
Viewer window operation
Message viewer property items and contents (1)
Message viewer property items and contents (2)

deal with email rules
Action “rule” to be executed conditionally from received mail
“Run AppleScript” environment in “Rule”
Plug-in Script for template mail .app
The rule is accessed from the AppleScript side
Rule condition to access the “condition” of the rule
Comparison of the rule condition and the contents on the GUI
Access the contents of the “operation” of the rule
Access the details of the rule “operation”

■ Advanced

Raising/receiving a URL Event
URL events supported by Mail.app
mailto: URL event (overview)
mailto: Create an email by generating a URL event
message: Request and display the URL of the local mail

Get email header information
Get the contents of the message header
Retrieve message (email) headers
Header configuration example
Get a list of field names from the header
Aggregate the mailer name (x-mailer)

Email Thread Visualization
Thread visualization (1)
Thread visualization (2) Selected email information
Thread visualization (3) Each email header information
Thread visualization (4) Creation of .dot data
Thread visualization (5) Display .dot data

Extract the distribution destination folder of the mailing list
Extract rules for processing mailing lists
Extract rules that do not have a message destination

Mail re-sorting
What is “mail re-sorting”?
“Re-sorting mail” Script change history
“Re-sorting mail” Script processing overview
“Re-sorting emails” Script ①
“Re-sorting emails” Script②
“Re-sorting emails” Script ③
“Resort mail” Script ④
“Resort mail” Script ⑤
“Resort mail” Script ⑥
“Resort mail” Script ⑦
“Resort mail” Script ⑧

Email creation with styled text + data merge
"To create a styled email
Create an email with formatting styles
Create a styled email from HTML
Creating a styled email from RTF (1)
Creating a styled email from RTF ②

Create an insert mail based on the data on Numbers
Data merge email transmission [Overview]
Data merge email transmission (1)
Data merge email transmission (2)
Data insertion mail transmission ③
Data merge mail transmission ④

High speed/mass mail transmission
Using a high-speed mail delivery service
List of high-speed mail delivery services
The path to obtaining SendGrid’s API Key (1)
The path to obtaining SendGrid’s API Key (2)
The path to obtaining SendGrid’s API Key (2)
Email delivery test by SendGrid (mail.app)
Email delivery test by SendGrid (mail.app)
E-mail distribution program by Mail.app (using SendGrid)
E-mail high-speed delivery program using REST API
Time required to send emails using SendGrid (500 emails)
Memory status after mass transmission with Mail.app

Choosing a runtime environment
There are many AppleScript execution environments
"If it stops or crashes during execution

collection of materials

Mail.app AppleScript terminology dictionary explanation
Mail.app term dictionary

Changes in AppleScript Terminology for Mail.app
Changes in the Mail.app terminology dictionary

Mail.app & AppleScript Q&A
Q&A about AppleScript❶
Q&A about AppleScript❷

AppleScript mini Reference
Documents related to AppleScript on macOS
Resources for AppleScript
Trends in macOS versions and AppleScript
Elemental technology history of macOS and AppleScript
AppleScript commentary for each macOS (2/4)
AppleScript commentary for each macOS (3/4)
AppleScript commentary for each macOS (4/4)
History of AppleScript helper tools in macOS
System Events AppleScript Terminology Changes
AppleScript runtime environment information
AppleScript-related tools
Cocoa Scripting related tools

List of AppleScript reserved words

Calling Third-Party Frameworks and AppleScript Libraries
Put Framework/AppleScript Libraries in Script Bundle
Transition of Shane Stanley’s Script Tool
Shane Stanley’s Script Libraries
Piyomaru Software’s Script Libraries (1/2)
Piyomaru Software’s Script Libraries (2/2)

Error code table
AppleScript error code
AppleScript Errors
Mac OS Errors
Apple Event Errors (1/2)
Apple Event Errors (2/2)
OSA Errors
Postscript

1 Like

Would love to purchase if you end up translating this to English

If many English people buy it, I’ll translate.

Many people say “Oh! you have to translate now! Then, somebody will buy it.”

If actual registerers exist, I can translate them…

A fisherman requires good bait…

Do you have any good English excerpts for folks to salivate over?

:sunglasses:

I write a book at 3 section.

Elementary: Very basic contents. Launch Script Editor, type in scripts, and execute it. Basic object control.

Intermediate: More advanced object control.

Advanced: High-level object control. Extreme level samples.

The balance may be suitable for Japanese un-experienced readers.

“Advanced” samples are bait, I think.