LoginSignup
2
3

More than 3 years have passed since last update.

Thunderbird(サンダーバード)で、コマンドラインからメールの下書きを作る

Last updated at Posted at 2020-07-22

基本

"C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe" -compose to='a@hoge.com',subject="タイトルテスト",body="本文テスト"

複数to、cc、添付ファイル

"C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe" -compose to='a@hoge.com,b@hoge.com',cc='a@fuga,com,b@fuga.com',subject="タイトルテスト",body="本文テスト",attachment="C:\temp\a.txt,D:\temp\b.pdf"

差し出し人を変えるにはpreselectidでIDを指定する

"C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe" -compose to='a@hoge.com',subject="タイトルテスト",body="本文テスト",preselectid=id2

preselectidの調べ方

ツール→オプション→一般→設定エディタ→「useremail」で絞り込み

参考

bodyに改行を入れる

上記をバッチファイルに落として、実行する際、本文テキストに改行を含むと、ハマる。

バッチファイルで改行を扱えないから。

setlocal enabledelayedexpansion
set MYARG=-compose to='a@hoge.com',subject="タイトルテスト",body="本文$テ$ス$ト"
"C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe" !MYARG:$=^

!

とする。
LateBindingで、渡すときに$を改行に置換すると動く。メンドクセ。

参考
https://teratail.com/questions/190411

2
3
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
2
3