0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Outlook を Apple Script でメール操作を自動化する

Last updated at Posted at 2025-10-21

目的

以下の記事を参考にしながら、自分に必要なメール操作の自動化についてまとめます。

要件

  • 宛名、To、CC をリストから取得
  • BCC に自分のアドレスを追加
  • メールはドラフトとして作成
    • 全体のメール数としては十数通なので、念のため、レビュー後に個別手動送信
  • ファイルを添付
  • 本文は改行を含め想定した形を挿入

リスト作成

以下のように 宛名1,To,宛名2,CC,宛名3,CC,... の形で .csv ファイルを作成します。

メール本文の宛先には 宛名1 を使用します。

宛名2宛名3 等は使用しないため、空欄でも問題ありません。

test_recipient.csv
鈴木,suzuki@example.jp
佐藤,sato@example.jp,高橋,takahashi@example.jp

メール本文

改行を <br> と置き換えた上で、以下のようにテキストファイルを作成します。

It turns out that Outlook imports AppleScript text as html, because it defaults to html email unless you uncheck that option in Preferences.
This means that any <br> in the text will be rendered as a newline!

mailcontent.txt
<br>
<br>
突然のご連絡失礼します。<br>
お世話になります、〇〇です。<br>
掲題の内容についてのお知らせする必要があり、連絡差し上げます。<br>
<br>
【背景】<br>
...<br>
...<br>
...<br>
<br>
【ご相談】<br>
...<br>
...<br>
<br>
ご不明な点がございましたら、ぜひお気軽にお問い合わせください。<br>
よろしくお願いします。<br>
<br>

添付ファイル

以下のようなディレクトリ構成で、添付ファイルとして attachment.pdf を準備します。

.
├── attachment.pdf
├── create_outlook_drafts.scpt
├── mailcontent.txt
└── test_recipient.csv

Apple Script

実行

Apple Script Editor でスクリプトを実行します。

image-20251021104432898 AM

その後、以下のメールがドラフトとしてメールを開いた状態で表示されます。

これで、念のためレビュー後に個別手動送信するところまで完了できました!

image-20251021104934209 AM

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?