「S-nail」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(文字列「Tips and tricks」を「ヒントとテクニック」に置換)
(校正)
 
(2人の利用者による、間の13版が非表示)
9行目: 9行目:
 
== インストール ==
 
== インストール ==
   
{{Pkg|s-nail}} パッケージ Arch Linux の {{Grp|base}} グループに含まれているため、最初からインストールされています。
+
{{Pkg|s-nail}} パッケージ [[インストール]] します。
  +
  +
== 使用例 ==
   
 
システム全体の設定ファイル ({{ic|/etc/mail.rc}}) には最初から有用な設定が含まれており、以下のように [[sendmail]] や [[postfix]] などのローカルメール転送エージェント (MTA) でメールを送信できます:
 
システム全体の設定ファイル ({{ic|/etc/mail.rc}}) には最初から有用な設定が含まれており、以下のように [[sendmail]] や [[postfix]] などのローカルメール転送エージェント (MTA) でメールを送信できます:
27行目: 29行目:
 
# echo bla | mailx -Sexpandaddr -s test '|cat >> ./mbox.mbox'
 
# echo bla | mailx -Sexpandaddr -s test '|cat >> ./mbox.mbox'
   
  +
プログラム環境のメンバーと設定ファイルの設定がプログラムの動作を変更するのを避けるために、スクリプトを設定ファイルから切り離し、{{ic|-S}} および {{ic|-X}} コマンドライン フラグを使用できます (そしてそうすべきです)。それぞれ独自のセットアップを作成し、必要なコマンドを実行します。
To avoid that members of the program environment and settings of configuration files modify program behaviour, scripts can (and should) detach from configuration files and use the {{ic|-S}} and {{ic|-X}} command line flags to create their own setup and run necessary commands, respectively.
 
   
  +
{{ic|expandaddr}} に値を指定して、アドレス検証に使用できます。たとえば、次の ''only'' はネットワーク アドレスを許可します。 {{ic|-.}} コマンド ライン オプションは、オプション処理を終了し、メッセージ送信モードをオンにします。これらが一緒になってアクティブなバリアを形成し、アドレス引数をコマンドラインオプションとして誤って解釈したり、その他のインジェクション攻撃を防止したりします。
{{ic|expandaddr}} can be given a value and be used for address verification. For example, the following ''only'' allows network addressees. The {{ic|-.}} command line option will terminate option processing and turn on message send mode. Together these form active barriers to prevent misinterpretation of address arguments as command line options and other injection attacks.
 
  +
次の例は、''somefile.pdf'' がどこかにある場合、{ic|-d}} を除いてそのまま使用できます。 {{ic|record}} 変数を、すべての送信メールの記録に使用されるフォルダーのパス名に設定します。これにより、生成されたメールを調べることができます。
The following example can be used as is, except for {ic|-d}}, provided that you have a ''somefile.pdf'' somewhere; it sets the {{ic|record}} variable to the pathname of the folder used to record all outgoing mail, so that we then can look into the generated message:
 
  +
メッセージ:
   
 
# echo Body |
 
# echo Body |
44行目: 47行目:
 
# mailx -Rf /tmp/out.mbox
 
# mailx -Rf /tmp/out.mbox
   
  +
マニュアルページの ''はじめに''、''メールを送信する''、''メールを読む'' のセクションは、さらに ''クイック ショット'' を探す場合に一見の価値があります。
The sections "A starter", "Sending mail" and "Reading mail" of the manual page should be worth a glance when looking for more "quick shots".
 
   
  +
次の ''USER'' と ''PASS'' が URL の一部として指定されている場合 (その場合のみ)、それらは URL パーセントでエンコードされる必要があります。 S-nail は、これを行う {{ic|urlcodec}} コマンドを提供しています。
In cases when in the following ''USER'' and ''PASS'' are specified as part of an URL (and only then), they must become URL-percent-encoded; S-nail offers the {{ic|urlcodec}} command which does this for you:
 
   
 
# printf 'urlcodec encode ''USER'' ''PASS''\nx\n' | mailx -#
 
# printf 'urlcodec encode ''USER'' ''PASS''\nx\n' | mailx -#
   
printf as well as S-nail / mailx are subject to your locale settings:
+
printf S-nail / mailx は、ロケール設定の影響を受けます。
   
 
# # In UTF-8:
 
# # In UTF-8:
65行目: 68行目:
 
設定ファイルは各ユーザー個別の {{ic|$HOME/.mailrc}} と全ユーザー共通の {{ic|/etc/mail.rc}} があり、後者のファイルは Arch Linux でアップデートしたときに変わる可能性があるため、変更や追加は前者のファイルに行ってください。
 
設定ファイルは各ユーザー個別の {{ic|$HOME/.mailrc}} と全ユーザー共通の {{ic|/etc/mail.rc}} があり、後者のファイルは Arch Linux でアップデートしたときに変わる可能性があるため、変更や追加は前者のファイルに行ってください。
   
  +
{{Tip|{{ic|-n}} コマンド ライン オプションを使用するか、{{ic|NAIL_NO_SYSTEM_RC}} を設定することにより、起動時に {{ic|/etc/mail.rc}} を読み取ることを禁止できます。また、{{ic|MAILRC}} 環境変数を {{ic|/dev/null}} に設定することにより、設定ファイルがロードされないことが保証されるため、次のように、スクリプトを実行するための再現可能な環境が作成されます。}}
{{Tip|By using the {{ic|-n}} command line option or by setting the {{ic|NAIL_NO_SYSTEM_RC}} reading {{ic|/etc/mail.rc}} upon startup can be inhibited. And by setting the {{ic|MAILRC}} environment variable to {{ic|/dev/null}} in addition it is ensured that no configuration file is loaded, so that a reproducable environment for running scripts is created, as shown by the script example above.}}
 
   
 
基本的なセキュリティや送信モードを設定する設定例:
 
基本的なセキュリティや送信モードを設定する設定例:
143行目: 146行目:
 
mlsubscribe ^xfans@xfans.xyz$
 
mlsubscribe ^xfans@xfans.xyz$
   
  +
上記の SSL/TLS 構成の組み合わせにより、可能な限り最も安全なエンドツーエンド TLS トランスポートが実現します。
The above combination of SSL/TLS configuration results in the most secure end-to-end TLS transport that is possible.
 
   
  +
== 外部 SMTP サーバーでメールを送信 ==
== ヒントとテクニック ==
 
   
  +
組み込みの SMTP (Simple Mail Transfer Protocol) クライアント経由で外部 SMTP サーバーにメッセージを送信するには、いくつかのオプションを設定または調整する必要があります。上記の構成に、太字の文字列を変更して、必要に応じて次を追加します。マニュアルのセクション {{man|1|mailx|URL 構文と資格情報の検索について}} を読むことは価値があります。
=== 外部 SMTP サーバーでメールを送信 ===
 
 
To send messages via the built-in SMTP (Simple Mail Transfer Protocol) client to an external SMTP server, several options have to be set or adjusted.
 
Add the following as appropriate to the configuration as above, changing bold strings.
 
Reading the manual section "On URL syntax and credential lookup" is worthwhile.
 
   
 
# It can be as easy as
 
# It can be as easy as
 
# (Remember '''USER''' and '''PASS''' must be URL percent encoded)
 
# (Remember '''USER''' and '''PASS''' must be URL percent encoded)
set smtp=smtp://'''USER''':'''PASS'''@'''HOST''' \
+
set mta=smtp://'''USER''':'''PASS'''@'''HOST''' \
 
smtp-use-starttls
 
smtp-use-starttls
 
 
 
# It may be necessary to set ''hostname'' and/or ''smtp-hostname''
 
# It may be necessary to set ''hostname'' and/or ''smtp-hostname''
# if the "SERVER" of ''smtp'' and "domain" of ''from'' don't match.
+
# if the "SERVER" of ''smtp'' and "domain" of ''from'' do not match.
 
# Reading the "ON URL SYNTAX.." and ''smtp'' manual entries may be worthwhile
 
# Reading the "ON URL SYNTAX.." and ''smtp'' manual entries may be worthwhile
set smtp='''(smtp[s]/submission)://[USER[:PASS]@]SERVER[:PORT]''' \
+
set mta='''(smtp[s]/submission)://[USER[:PASS]@]SERVER[:PORT]''' \
 
smtp-auth='''login[/plain]...''' \
 
smtp-auth='''login[/plain]...''' \
 
smtp-use-starttls
 
smtp-use-starttls
172行目: 171行目:
 
localopts yes
 
localopts yes
 
# (The plain smtp:// proto is optional)
 
# (The plain smtp:// proto is optional)
set smtp='''USER:PASS'''@smtp.gmXil.com smtp-use-starttls
+
set mta=smtp://'''USER:PASS'''@smtp.gmXil.com smtp-use-starttls
 
set from="'''Your Name <youremail@domain>'''"
 
set from="'''Your Name <youremail@domain>'''"
 
}
 
}
184行目: 183行目:
 
account XandeX {
 
account XandeX {
 
localopts yes
 
localopts yes
set smtp=smtps://'''USER:PASS'''@smtp.yaXXex.ru:465 \
+
set mta=smtps://'''USER:PASS'''@smtp.yaXXex.ru:465 \
 
hostname=yaXXex.com smtp-hostname=
 
hostname=yaXXex.com smtp-hostname=
 
set from="'''Your Name <youremail@domain>'''"
 
set from="'''Your Name <youremail@domain>'''"
 
}
 
}
   
  +
{{Tip|Gmail で 2 段階認証を有効にし、S-nail 用のアプリケーション固有のパスワードを追加します。通常の Gmail パスワードではなく、そのパスワードを使用する必要があります。}}
{{Tip|If you have enabled two-step authentication in Gmail, and you have added an application specific password for S-nail, you will want to use that password rather than your regular Gmail password, which may work without enabling the otherwise necessary "less secure apps".}}
 
   
  +
{{ic|$HOME/.mailrc}} にパスワードを保存する場合は、{{ic|chmod 0600}} で適切な [[ファイルのパーミッションと属性]] を設定する必要があることに注意してください。 ''netrc-lookup'' オプションを設定して、代わりに {{ic|$HOME/.netrc}} (または ''$NETRC'') にユーザー資格情報を保存することもできます。たとえば、SMTP、POP3、および IMAP をセットアップし、そこにすべてのユーザー資格情報を保存する実際の例を次に示します。
Note that, when storing passwords in {{ic|$HOME/.mailrc}}, you should set appropriate permissions with {{ic|chmod 0600}}.
 
You can also set the ''netrc-lookup'' option and store user credentials in {{ic|$HOME/.netrc}} (or ''$NETRC'') instead; e.g., here is a real life example that sets up SMTP, POP3 as well as IMAP, storing all user credentials in there:
 
   
 
account XandeX {
 
account XandeX {
 
localopts yes
 
localopts yes
 
set from="Your Name <youremail@domain>"
 
set from="Your Name <youremail@domain>"
set netrc-lookup
+
wysh set netrc-lookup # netrc-pipe='gpg -qd ~/.netrc.gpg'
  +
set mta=smtps://smtp.yXXXXx.ru:465 \
#set agent-shell-lookup="gpg -d .pass.gpg"
 
set smtp=smtps://smtp.yXXXXx.ru:465 \
 
 
smtp-hostname= hostname=yXXXXx.com
 
smtp-hostname= hostname=yXXXXx.com
 
set pop3-keepalive=240
 
set pop3-keepalive=240
 
shortcut pop pop3s://pop.yXXXXx.ru
 
shortcut pop pop3s://pop.yXXXXx.ru
 
# Type '''xp''' to login to the POP3 account
 
# Type '''xp''' to login to the POP3 account
ghost xp 'fi pop'
+
commandalias xp 'fi pop'
 
set imap-keepalive=240
 
set imap-keepalive=240
 
shortcut imap imaps://imap.yXXXXx.ru
 
shortcut imap imaps://imap.yXXXXx.ru
 
# Type '''xi''' to login to the IMAP account
 
# Type '''xi''' to login to the IMAP account
ghost xi 'fi imap'
+
commandalias xi 'fi imap'
 
}
 
}
   
and, in {{ic|$HOME/.netrc}}:
+
そして、{{ic|$HOME/.netrc}}:
   
 
machine *.yXXXXx.ru login '''USER''' password '''PASS'''
 
machine *.yXXXXx.ru login '''USER''' password '''PASS'''
   
  +
この場合、'''USER''' と '''PASS''' はクリアテキストであり、URL エンコードされていません。 ArchLinux はパスワード エージェント サポートでコンパイルされるため、さらに多様化して暗号化されたパスワード ストレージを使用できます。
In this case '''USER''' and '''PASS''' are clear text, not URL encoded. You can further diversify things and use encrypted password storage, since ArchLinux compiles in password agent support.
 
  +
例を調整するには、{{ic|$HOME/.netrc}} で ''password'' ''PASS'' トークンを指定しないで、代わりに ''agent-shell-lookup'' 行のコメントを外します。上記の例のアカウント。
To adjust the example, simply do not specify the ''password '''PASS''''' token in {{ic|$HOME/.netrc}} but instead uncomment the ''agent-shell-lookup'' line in the example account above.
 
  +
暗号化されたパスワード ストレージ {{ic|.pass.gpg}} は、次のように作成できます。
The encrypted password storage {{ic|.pass.gpg}} can be created like this:
 
   
# echo '''PASS''' > .pass
+
# gpg -e .netrc
# gpg -e .pass
 
 
# eval `gpg-agent --daemon --pinentry-program=/usr/bin/pinentry-curses --max-cache-ttl 99999 --default-cache-ttl 99999`
 
# eval `gpg-agent --daemon --pinentry-program=/usr/bin/pinentry-curses --max-cache-ttl 99999 --default-cache-ttl 99999`
   
  +
構成をテストします (''-d'' コマンド ライン オプションを使用します。) dry-run):
Test the configuration (use the ''-d'' command line option for a dry-run):
 
   
# echo test-body | mailx -vv -A XandeX -s test-subject '''some@where'''
+
# echo test-body | mailx --verbose --verbose --account=XandeX --subject=test-subject '''some@where'''
   
=== インタラクティブな使用方法 ===
+
== インタラクティブな使用方法 ==
   
 
Arch Linux の S-nail にはコマンドラインエディタが組み込まれており、履歴機能や正規表現、メッセージのカラー表示が使えます。S-nail は POSIX 標準に準拠しているためインタラクティブに使う前に設定を変更する必要があります。全ての設定に手を入れる必要はありませんがマニュアルは必ず読んでください。最低でも設定の一番上に以下を追加してください:
 
Arch Linux の S-nail にはコマンドラインエディタが組み込まれており、履歴機能や正規表現、メッセージのカラー表示が使えます。S-nail は POSIX 標準に準拠しているためインタラクティブに使う前に設定を変更する必要があります。全ての設定に手を入れる必要はありませんがマニュアルは必ず読んでください。最低でも設定の一番上に以下を追加してください:
235行目: 231行目:
 
 
 
# Start into interactive mode even if the system mailbox is empty or
 
# Start into interactive mode even if the system mailbox is empty or
# doesn't exist. S-nail would exit immediately without that one
+
# does not exist. mailx will exit immediately without that one
 
set emptystart
 
set emptystart
 
 
# When composing a message, let period `.' on a line by itself finalize
+
# When composing a message, start directly into ''$EDITOR''
# composition, before start directly into ''$EDITOR''
 
set dot
 
 
set editalong
 
set editalong
 
 
246行目: 240行目:
 
# without VALUE: screen ''$LINES''
 
# without VALUE: screen ''$LINES''
 
set crt=
 
set crt=
 
# Colourize headers when displaying messages (note that ''$PAGER'' may
 
# require special flags, e.g., less(1) needs the -R option; S-nail will
 
# however set the ''$LESS'' environment variable accordingly, but only if
 
# that was not set before..)
 
set colour-pager
 
 
 
 
# A nicer prompt for a modern terminal
 
# A nicer prompt for a modern terminal
set prompt="\033[31m?\?[\$ \@]\& \033[0m"
+
wysh set prompt='?\${?}!\${!}[\${account}#\${mailbox-display}]? '
 
 
 
# Add more entries to the history, and make that persistent
 
# Add more entries to the history, and make that persistent
set history-gabby NAIL_HISTFILE=+.s-nailhist NAIL_HISTSIZE=-1
+
set history-gabby history-file=+.s-nailhist
 
 
# When '''p'''rinting messages, show only these headers
 
# When '''p'''rinting messages, show only these headers
 
# (Easier to '''retain''' what you want than to '''ignore'''
 
# (Easier to '''retain''' what you want than to '''ignore'''
# what you don't; use '''P'''rint to see all headers and '''S'''how
+
# what you do not; use '''P'''rint to see all headers and '''S'''how
 
# to see the raw message content)
 
# to see the raw message content)
 
retain date from to cc subject
 
retain date from to cc subject
267行目: 254行目:
 
# Try to get around weird MIME attachment specifications
 
# Try to get around weird MIME attachment specifications
 
# (This option can take a value, see the manual for more)
 
# (This option can take a value, see the manual for more)
set mime-counter-evidence
+
set mime-counter-evidence=0xE
 
 
 
# Display HTML parts inline, nicer than what the builtin viewer can achieve
 
# Display HTML parts inline, nicer than what the builtin viewer can achieve
#set pipe-text/html="lynx -stdin -dump -force_html"
+
#set pipe-text/html='@* lynx -stdin -dump -force_html'
 
# Learn another mimetype
 
# Learn another mimetype
mimetype 'model/vrml wrl vrml'
+
mimetype model/vrml wrl vrml
 
 
 
# Create some new commands so that, e.g., `ls /tmp' will..
 
# Create some new commands so that, e.g., `ls /tmp' will..
ghost ls !ls -latro
+
commandalias ls !ls -latro
ghost ps !ps axu
+
commandalias ps !ps axu
   
  +
一旦中に入ったら、''list'' を使って利用可能な全ての組み込みコマンドを表示させましょう。
Once you're in it use '''list''' to print all available builtin commands.
 
ArchLinux compiles in the "DOCSTRINGS" feature, so that typing `?X' tries to expand "X" and print a help string; since S-nail will allow abbreviations of all commands this is sometimes handy; try, e.g., '''?h''', '''?he''' and '''?hel''' ...
+
ArchLinux "DOCSTRINGS" 機能でコンパイルされ、`?X' と入力すると "X" を展開してヘルプ文字列を表示します。S-nail は全てのコマンドの省略を許しているので、これは時々便利です; 例えば ''?h'', ''?he'', ''?hel'' ... といった具合に試してみてください。
  +
''help'' コマンドは最も頻繁に使用されるコマンドの短い要約を表示します。
The command '''help''' will print a short summary of the most frequent used commands.
 
   
==== コマンド ====
+
=== コマンド ===
   
  +
対話モードを開始すると、{{ic|headers}} コマンドを介して、最初に開かれたメールボックスの内容の概要が出力されます。
When starting into interactive mode a summary of the content of the initially opened mailbox is printed, as via the '''headers''' command.
 
  +
ヘッダー表示メッセージには、メッセージを一意に識別する番号 (1 から始まる) が付けられます。メッセージは、{{ic|print}} コマンド、または略して {{ic|p}} で印刷できます。 {{ic|p}} は表示されるヘッダーのリストを {{ic|retain}} (または {{ic|ignore}}) しますが、{{ic|P}} print コマンドはすべてを表示します。ヘッダー; {{ic|Sh}} ow コマンドは生のメッセージ コンテンツを出力します。
In the header display messages are given numbers (starting at 1) which uniquely identify messages.
 
Messages can be printed with the '''print''' command, or short: '''p'''.
 
Whereas '''p''' honours '''retain'''ed (or '''ignore'''d) list of headers to be displayed, the '''P'''rint command will not and display all headers;
 
the '''Sh'''ow command will print raw message content.
 
   
  +
デフォルトでは、現在のメッセージ (ドット) が表示されますが、他の多くのコマンドと同様に、マニュアルのセクション {{man|1|mailx|メッセージの指定}} に記載されているように、メッセージのリストを指定することができます。たとえば、{{ic|p:u}} はすべての未読メッセージを表示し、{{ic|p.}} は現在のメッセージ (ドット) を出力し、{{ic|p 1 5}} はメッセージ 1 と 5 を出力します。 {{ic|p-}} と {{ic|p+}} は、それぞれ前のメッセージと次のメッセージを出力します。空行に単純に RETURN を入力すると、{{ic|next}} ({{ic|n}}) のように動作し、次のメッセージが出力されることに注意してください。
By default the current message (dot) is printed, but just like with many other commands it is possible to specify lists of messages, as is documented in the manual section "Specifying messages"; e.g., '''p:u''' will display all unread messages, '''p.''' will print the dot, '''p 1 5''' will print the messages 1 and 5 and '''p-''' and '''p+''' will print the last and the next message, respectively.
 
Note that simply typing RETURN in an empty line acts like '''next''' ('''n'''), and thus prints the next message.
 
   
  +
コマンド {{ic|from}} は概要を表示するのに便利です。たとえば、{{ic|f '@@arch linux}} は、メッセージ ヘッダーに文字列 'arch linux' を含むすべてのメッセージのヘッダー サマリーを出力します。一方、{{ic|f '@arch linux}} は、件名に 'arch linux' が含まれるもののみに一致します。最後に、正規表現 {{ic|f @^A[^[:space:]]+}} は、件名が A 文字で始まり、A の直後に空白文字がないすべてのメッセージを検索します。検索式などに空白がある場合に必要になる場合があります。
The command '''from''' ('''f''') is nice for an overview, e.g., '''f '@<@arch linux'''' will print the header summary of all messages that contain the string "arch linux" in some message header, whereas '''f '@arch linux'''' will only match those with "arch linux" in their subject;
 
finally, the regular expression '''f @^A[^[:space:]]+''' finds...
 
that is, be aware that quoting may be necessary when there is whitespace in search expressions etc.
 
   
  +
* {{ic|file}} {{ic|File}} 新しいメールボックスを開きます。後者は読み取り専用モードです
* '''file''' and '''File''' open a new mailbox, the latter in readonly mode (which can be handy to avoid flag updates etc.)
 
  +
* {{ic|newmail}} (メールボックスに応じて、新しいメールをチェックし) 新しいメッセージのリストを出力します
* '''newmail''' (dependent on the mailbox, checks for new mail and) prints a listing of new messages
 
* '''he''' (headers) reprints the message list
+
* {{ic|he}} (headers) メッセージリストを再印刷します
  +
* {{ic|z-}} {{ic|z+}} {{ic|z0}} {{ic|z$}} ヘッダー表示をスクロールします (使用している端末によっては、Home/End/PageUp/PageDown キーがエイリアスとして機能します)
* '''z-''', '''z+''', '''z0''', '''z$''' scroll through the header display (dependent on the terminal you are using the Home/End/PageUp/PageDown keys will be working aliases)
 
  +
* {{ic|folders}} 現在設定されている {{ic|folder}} の下にあるメールボックスのリストを表示します
* '''folders''' shows a listing of mailboxes under the currently set ''folder''
 
  +
* {{ic|r}} 指定されたメッセージのすべての宛先に返信します
* '''r''' replies to all addressees of the given message(s)
 
  +
* {{ic|R}} 指定されたメッセージの送信者に返信します
* '''R''' replies to the sender of the given message(s)
 
  +
* {{ic|Lreply}} 指定されたメッセージ "メーリングリスト" への返信
* '''Lreply''' "mailing-list" reply to the given message(s)
 
* '''move''' or '''mv''' moves (a) message(s)
+
* {{ic|move}} または {{ic|mv}} (a) メッセージを移動します
  +
* {{ic|(un)flag}} (a) 件のメッセージをフラグなし (未) としてマーク
* '''(un)flag''' marks (a) message(s) as (un)flagged
 
  +
* {{ic|new}} (a) 件のメッセージを未読にします
* '''new''' marks (a) message(s) unread
 
  +
* {{ic|seen}} (a) 個のメッセージを既読にします
* '''seen''' marks (a) message(s) read
 
  +
* {{ic|P}} (a) 個のメッセージをすべてのヘッダーとともに出力します
* '''P''' prints (a) message(s) with all headers
 
  +
* {{ic|p}} (a) メッセージとすべての無視されないヘッダーを出力します
* '''p''' prints (a) message(s) and all non-ignored headers.
 
  +
* {{ic|show}} (a) メッセージコンテンツの raw メッセージを出力します
* '''show''' prints the raw message of content of (a) message(s)
 
  +
* {{ic|write}} それか {{ic|w}} メッセージと添付ファイルをネイティブ形式でローカルストレージにダウンロードする
   
==== メッセージの作成 ====
+
=== メッセージの作成 ===
   
  +
作成は、{{ic|mail user@host}} と入力するか、メッセージに返信することで開始されます。{{ic|$EDITOR}} を入力すると ({{ic|editalong}} が設定されていると仮定します) ネイティブエディタが表示され、チルダエスケープを使って多くの操作ができます ({{ic|~?}} で短いヘルプが表示されます、 特に興味深いのは {{ic|~@}} で、これは添付ファイルのリストを対話的に編集することができ、引数が与えられると、追加の添付ファイルを (n) (カンマで区切られたリスト) を追加できます。
Composition is started by typing '''mail user@host''' or by replying to a message.
 
When you return from ''$EDITOR'' (assuming ''editalong'' is set) you'll find yourself in the native editor, where many operations can be performed using tilde escapes (short help available via '''~?''').
 
Of particular interest is '''~@''', which either allows interactive editing of the attachment list, or, when given arguments, to add a(n) (comma-separated list of) additional attachment(s).
 
   
  +
メールを送信するには、{{ic|Ctrl+d}} で EOT を送るか、 {{ic|~.}} を単独でタイプしてください。
To send the mail, signal EOT with {{ic|Ctrl+d}} or type "." on its own line (the latter requires the ''dot'' option).
 
   
=== S/MIME を使う ===
+
== S/MIME を使う ==
   
  +
マニュアルには、証明書などの作成方法のステップバイステップの例 ({{man|1|mailx|S/MIME で署名・暗号化されたメッセージ}} と同様に {{man|1|mailx|S/MIME step by step}}) が記載されています。秘密鍵と署名された証明書がすでにあるとして、必要なペアファイルを作成するだけです。
The manual contains a step-by-step example of how to create your certificates etc. ("Signed and encrypted messages with S/MIME").
 
Assuming you have your private key and signed certificate already, just create the paired file we need
 
   
 
# cat private-key.pem signed-certificate.pem > ~/pair.pem
 
# cat private-key.pem signed-certificate.pem > ~/pair.pem
   
  +
S-nailをセットアップします
and setup S-nail via
 
   
 
set smime-sign-cert=~/pair.pem \
 
set smime-sign-cert=~/pair.pem \
334行目: 313行目:
 
smime-sign
 
smime-sign
   
  +
今後、送信されるすべてのメッセージは署名されるようになります。デフォルトのメッセージダイジェストは、[[RFC:5751]] で指定されているように SHA1 です。S/MIME は常に変数 ''from'' の設定に関連して動作するので、代わりに {{ic|account}} に上記の設定を置くことが最善と思われます。{{ic|verify}} コマンドは S/MIME メッセージを検証しますが、S/MIME の復号と検証は今のところ OpenSSL にのみ基づいており、単純な MIME 構造のメッセージにのみ対応していることに注意してください。
From now any message that is sent will be signed.
 
The default message digest would be SHA1, as mandated by RFC 5751.
 
Note that S/MIME always works relative to the setting of the variable ''from'', so it seems best to instead place the above settings in an '''account'''.
 
The '''verify''' command verifies S/MIME messages, but note that S/MIME decryption and verification is solely based upon OpenSSL for now, which only supports messages with a simplicistic MIME structure. Sorry.
 
By the way, if you miss hyperlinks and a table-of-content to get yourself going, the manual on the projects' website offers this; and the manual that ships with ArchLinux does, too, but needs the mdocmx(7) extension to be visible.
 
   
=== OpenPGP のサポート ===
+
== OpenPGP のサポート ==
   
 
S-nail は OpenPGP をサポートしていませんが、マクロを使うことで自動的に ''--clearsign'' されたメッセージを検証することができます。リソースファイルで以下を使うことで '''V''' を押すだけでメッセージを検証することが可能です:
 
S-nail は OpenPGP をサポートしていませんが、マクロを使うことで自動的に ''--clearsign'' されたメッセージを検証することができます。リソースファイルで以下を使うことで '''V''' を押すだけでメッセージを検証することが可能です:
379行目: 354行目:
 
ghost RK call RK
 
ghost RK call RK
   
=== IMAP メールボックスを使う ===
+
== IMAP メールボックスを使う ==
   
  +
以下は簡単なヒントです。たとえば、''folder'' と ''inbox'' を定義して IMAP サーバーフォルダーを指すようにすることもできます。
The following is only a quick hint, it is also possible to define ''folder'' and ''inbox'' to point to IMAP server folders, for example.
 
  +
国際化された名前がサポートされています。
Internationalised names are supported.
 
   
 
set v15-compat
 
set v15-compat
393行目: 368行目:
 
shortcut myimap "'''imaps://USER:PASS@server:port"
 
shortcut myimap "'''imaps://USER:PASS@server:port"
 
set inbox=myimap
 
set inbox=myimap
  +
  +
== 参照 ==
  +
  +
* [https://www.sdaoden.eu/code.html S-nail ウェブサイト]

2023年2月9日 (木) 16:16時点における最新版

S-nail (heirloom-mailx のフォーク) は ed と同じようなコマンド構文が使えるメール処理システムです。ed における行がメッセージになります。POSIX の mailx コマンドの機能を実現し行編集や IDNA, MIME, S/MIME, SMTP, POP3 (IMAP) などの拡張を提供します。メールバッチ言語として使うことが可能です。

S-nail は Unix のメールシステムのユーザーサイドを担うものであり、システムサイドは伝統的に sendmail が使われていました。

Arch Linux では S-nail は SMTP によるメールの直接配達に対応しているため、外部の SMTP サーバーに直接メッセージを送信することができます。その場合、ローカルのメール転送エージェント (MTA) はシステムサイドには不要です。ただし、S-nail にはメールキュー機構が存在しません。SMTP で直接かつ即座にメッセージを送るだけです。

インストール

s-nail パッケージを インストール します。

使用例

システム全体の設定ファイル (/etc/mail.rc) には最初から有用な設定が含まれており、以下のように sendmailpostfix などのローカルメール転送エージェント (MTA) でメールを送信できます:

# echo 'Message body' | mailx -d -s 'A subject' -a an_attachment.txt foo1@bar.example 'Foo2 <foo2@bar.example>'

-d フラグを付けることでドライランとなり実際にはメールは送信されません (saverecord 設定も無視されます)。sendmail 変数を設定することで MTA として使用するプログラムを調整できます (sendmail-arguments, sendmail-no-default-arguments, sendmail-progname など詳しくはマニュアルの "Sending mail" を参照):

# < /etc/passwd mailx -Ssendmail=/usr/bin/sendmail -Ssendwait -s 'My password file content!' public-foo@bar.example
# echo Message was passed successfully: $?

デフォルトではメールの配達は非同期となっており、メッセージが配達システム (MTA など) に渡されると S-nail はすぐに終了します。メッセージの準備ができたかどうかだけ出力します。sendwait オプションを設定した場合、S-nail は起動した MTA インスタンスが終了するまで待機し、MTA の終了ステータスを確認してメールの配達が成功したか失敗したか判断します。

expandaddr オプションを設定した場合、ファイルやコマンドにメッセージを送信することができます:

# echo bla | mailx -Sexpandaddr -s test ./mbox.mbox
# echo bla | mailx -Sexpandaddr -s test '|cat >> ./mbox.mbox'

プログラム環境のメンバーと設定ファイルの設定がプログラムの動作を変更するのを避けるために、スクリプトを設定ファイルから切り離し、-S および -X コマンドライン フラグを使用できます (そしてそうすべきです)。それぞれ独自のセットアップを作成し、必要なコマンドを実行します。

expandaddr に値を指定して、アドレス検証に使用できます。たとえば、次の only はネットワーク アドレスを許可します。 -. コマンド ライン オプションは、オプション処理を終了し、メッセージ送信モードをオンにします。これらが一緒になってアクティブなバリアを形成し、アドレス引数をコマンドラインオプションとして誤って解釈したり、その他のインジェクション攻撃を防止したりします。 次の例は、somefile.pdf がどこかにある場合、{ic|-d}} を除いてそのまま使用できます。 record 変数を、すべての送信メールの記録に使用されるフォルダーのパス名に設定します。これにより、生成されたメールを調べることができます。 メッセージ:

# echo Body |
#   LC_ALL=C MAILRC=/dev/null \
#   mailx -d -n -Sv15-compat -Ssendwait \
#     -Sexpandaddr=fail,-all,+addr \
#     -Snosave -Srecord=/tmp/out.mbox \
#     -Smimetypes-load-control \
#     -X'mimetype "application/pdf pdf"' \
#     -Sfrom='Me <me@home>' \
#     -a somefile.pdf -s Subject \
#      -. '(foo2bar) <foo2@bar.example>' bob@hey.example
# mailx -Rf /tmp/out.mbox

マニュアルページの はじめにメールを送信するメールを読む のセクションは、さらに クイック ショット を探す場合に一見の価値があります。

次の USERPASS が URL の一部として指定されている場合 (その場合のみ)、それらは URL パーセントでエンコードされる必要があります。 S-nail は、これを行う urlcodec コマンドを提供しています。

# printf 'urlcodec encode USER PASS\nx\n' | mailx -#

printf と S-nail / mailx は、ロケール設定の影響を受けます。

# # In UTF-8:
# printf 'urlcodec encode SPAß\nx\n' | mailx -#
  in: <SPAß> (5 bytes)
  out: <SPA%C3%9F> (9 bytes)
# # In ISO-8859-1:
# printf 'urlc enc SPAß\nx\n' | mailx -#
  in: <SPAß> (4 bytes)
  out: <SPA%DF> (6 bytes)

設定

設定ファイルは各ユーザー個別の $HOME/.mailrc と全ユーザー共通の /etc/mail.rc があり、後者のファイルは Arch Linux でアップデートしたときに変わる可能性があるため、変更や追加は前者のファイルに行ってください。

ヒント: -n コマンド ライン オプションを使用するか、NAIL_NO_SYSTEM_RC を設定することにより、起動時に /etc/mail.rc を読み取ることを禁止できます。また、MAILRC 環境変数を /dev/null に設定することにより、設定ファイルがロードされないことが保証されるため、次のように、スクリプトを実行するための再現可能な環境が作成されます。

基本的なセキュリティや送信モードを設定する設定例:

# All the examples require v15-compat!
set v15-compat

# ArchLinux-specific locations of certificates.
# Since these are subject to the ArchLinux update mechanism,
# use only those, don't try to load OpenSSL builtin ones.
# And use the TLS specific set: see "man 8 update-ca-trust"
#set ssl-ca-dir=/etc/ssl/certs
set ssl-ca-file=/etc/ssl/certs/ca-certificates.crt
set ssl-no-default-ca

# Don't use protocols older than TLS v1.2.
# Change this only when the remote server doesn't support it:
# maybe use ssl-protocol-HOST (or -USER@HOST) syntax to define
# such explicit exceptions, then, e.g.
#     ssl-protocol-USER@archlinux.org="-ALL,+TLSv1.2"
set ssl-protocol="-ALL,+TLSv1.2"

# Explicitly define the list of ciphers, which may improve security,
# especially with protocols older than TLS v1.2.  See ciphers(1).
# Hint: it is important to include "@STRENGTH": only with it the
# final list will be sorted by algorithm strength.
# This is an example: in reality it is possibly best to only use
# ssl-cipher-list-HOST (or -USER@HOST), as necessary, again..
set ssl-cipher-list="ALL:!aNULL:!eNULL:!MEDIUM:!LOW:!MD5:!RC4:!EXPORT:@STRENGTH"

# Request strict transport security checks
set ssl-verify=strict

# Essential setting: select allowed character sets
# (Have a look at the "CHARACTER SETS" manual section)
set sendcharsets=utf-8,iso-8859-1

# A very kind option: when replying to a message, first try to
# use the same encoding that the original poster used herself!
set reply-in-same-charset

# When replying to or forwarding a message the comment and name
# parts of email addresses are removed unless this variable is set
set fullnames

# When sending messages, wait until the Mail-Transfer-Agent finishs.
# Only like this you'll be able to see errors reported through the exit
# status of the MTA (including the builtin SMTP one)!
set sendwait

# Only use builtin MIME types, no mime.types(5) files.
# That set is often sufficient, but look at the output of the
# mimetype command to ensure this is true for you, too
set mimetypes-load-control

# Default directory where we act in (relative to $HOME if not absolute)
set folder=mail
# A leading "+" (often) means: under folder
# record is used to save copies of sent messages, DEAD is error storage
# inbox: system mailbox, by default /var/mail/$USER: file %
# MBOX: secondary mailbox: file &
set MBOX=+mbox.mbox record=+sent.mbox DEAD=+dead.mbox
set inbox=+system.mbox

# Define some shortcuts; now one may say, e.g., file mymbo
shortcut mymbo %:+mbox.mbox \
         myrec +sent.mbox

# This is optional, but you should get the big picture
# by reading the manual before you leave that off
set from="Your Name <youremail@domain>" 

# Mailing-list specifics (manual: "Mailing lists"):
set followup-to followup-to-honour=ask-yes reply-to-honour=ask-yes
# And teach some non-subscribed / some subscribed lists, too
mlist @xyz-editor.xyz$ @xyzf.xyz$
mlsubscribe ^xfans@xfans.xyz$

上記の SSL/TLS 構成の組み合わせにより、可能な限り最も安全なエンドツーエンド TLS トランスポートが実現します。

外部 SMTP サーバーでメールを送信

組み込みの SMTP (Simple Mail Transfer Protocol) クライアント経由で外部 SMTP サーバーにメッセージを送信するには、いくつかのオプションを設定または調整する必要があります。上記の構成に、太字の文字列を変更して、必要に応じて次を追加します。マニュアルのセクション mailx(1) § URL 構文と資格情報の検索について を読むことは価値があります。

# It can be as easy as
# (Remember USER and PASS must be URL percent encoded)
set mta=smtp://USER:PASS@HOST \
    smtp-use-starttls

# It may be necessary to set hostname and/or smtp-hostname
# if the "SERVER" of smtp and "domain" of from do not match.
# Reading the "ON URL SYNTAX.." and smtp manual entries may be worthwhile
set mta=(smtp[s]/submission)://[USER[:PASS]@]SERVER[:PORT] \
    smtp-auth=login[/plain]... \
    smtp-use-starttls

# E.g. here is a real life example of a very huge free mail provider
# (Activate this account via mailx -AXooglX from the command line,
# or use the ? acc[ount] XooglX command in interactive mode)
account XooglX {
   # Localize options, forget them when changing the account
   localopts yes
   # (The plain smtp:// proto is optional)
   set mta=smtp://USER:PASS@smtp.gmXil.com smtp-use-starttls
   set from="Your Name <youremail@domain>"
}

# And here is a pretty large one which does not allow sending mails
# if there is a domain name mismatch on the SMTP protocol level,
# which would bite us if the value of from does not match, e.g.,
# for people who have a sXXXXeforge project and want to speak
# with the mailing list under their project account (in from),
# still sending the message through their normal mail provider
account XandeX {
   localopts yes
   set mta=smtps://USER:PASS@smtp.yaXXex.ru:465 \
       hostname=yaXXex.com smtp-hostname=
   set from="Your Name <youremail@domain>"
}
ヒント: Gmail で 2 段階認証を有効にし、S-nail 用のアプリケーション固有のパスワードを追加します。通常の Gmail パスワードではなく、そのパスワードを使用する必要があります。

$HOME/.mailrc にパスワードを保存する場合は、chmod 0600 で適切な ファイルのパーミッションと属性 を設定する必要があることに注意してください。 netrc-lookup オプションを設定して、代わりに $HOME/.netrc (または $NETRC) にユーザー資格情報を保存することもできます。たとえば、SMTP、POP3、および IMAP をセットアップし、そこにすべてのユーザー資格情報を保存する実際の例を次に示します。

account XandeX {
   localopts yes
   set from="Your Name <youremail@domain>"
   wysh set netrc-lookup # netrc-pipe='gpg -qd ~/.netrc.gpg'
   set mta=smtps://smtp.yXXXXx.ru:465 \
       smtp-hostname= hostname=yXXXXx.com
   set pop3-keepalive=240
   shortcut pop pop3s://pop.yXXXXx.ru
   # Type xp to login to the POP3 account
   commandalias xp 'fi pop'
   set imap-keepalive=240
   shortcut imap imaps://imap.yXXXXx.ru
   # Type xi to login to the IMAP account
   commandalias xi 'fi imap'
 }

そして、$HOME/.netrc:

machine *.yXXXXx.ru login USER password PASS

この場合、USERPASS はクリアテキストであり、URL エンコードされていません。 ArchLinux はパスワード エージェント サポートでコンパイルされるため、さらに多様化して暗号化されたパスワード ストレージを使用できます。 例を調整するには、$HOME/.netrcpassword PASS トークンを指定しないで、代わりに agent-shell-lookup 行のコメントを外します。上記の例のアカウント。 暗号化されたパスワード ストレージ .pass.gpg は、次のように作成できます。

# gpg -e .netrc
# eval `gpg-agent --daemon --pinentry-program=/usr/bin/pinentry-curses --max-cache-ttl 99999 --default-cache-ttl 99999`

構成をテストします (-d コマンド ライン オプションを使用します。) dry-run):

# echo test-body | mailx --verbose --verbose --account=XandeX --subject=test-subject some@where

インタラクティブな使用方法

Arch Linux の S-nail にはコマンドラインエディタが組み込まれており、履歴機能や正規表現、メッセージのカラー表示が使えます。S-nail は POSIX 標準に準拠しているためインタラクティブに使う前に設定を変更する必要があります。全ての設定に手を入れる必要はありませんがマニュアルは必ず読んでください。最低でも設定の一番上に以下を追加してください:

# (The global configuration /etc/mail.rc provides some commented basics;
# in particular it shows all options that POSIX mandates as defaults.)

# Start into interactive mode even if the system mailbox is empty or
# does not exist.  mailx will exit immediately without that one
set emptystart

# When composing a message, start directly into $EDITOR
set editalong

# Start $PAGER when a message is longer than VALUE lines;
# without VALUE: screen $LINES
set crt=

# A nicer prompt for a modern terminal
wysh set prompt='?\${?}!\${!}[\${account}#\${mailbox-display}]? '

# Add more entries to the history, and make that persistent
set history-gabby history-file=+.s-nailhist
# When printing messages, show only these headers
# (Easier to retain what you want than to ignore
# what you do not; use Print to see all headers and Show
# to see the raw message content)
retain date from to cc subject

# Try to get around weird MIME attachment specifications
# (This option can take a value, see the manual for more)
set mime-counter-evidence=0xE

# Display HTML parts inline, nicer than what the builtin viewer can achieve
#set pipe-text/html='@* lynx -stdin -dump -force_html'
# Learn another mimetype
mimetype model/vrml wrl vrml

# Create some new commands so that, e.g., `ls /tmp' will..
commandalias ls !ls -latro
commandalias ps !ps axu

一旦中に入ったら、list を使って利用可能な全ての組み込みコマンドを表示させましょう。 ArchLinux は "DOCSTRINGS" 機能でコンパイルされ、`?X' と入力すると "X" を展開してヘルプ文字列を表示します。S-nail は全てのコマンドの省略を許しているので、これは時々便利です; 例えば ?h, ?he, ?hel ... といった具合に試してみてください。 help コマンドは最も頻繁に使用されるコマンドの短い要約を表示します。

コマンド

対話モードを開始すると、headers コマンドを介して、最初に開かれたメールボックスの内容の概要が出力されます。 ヘッダー表示メッセージには、メッセージを一意に識別する番号 (1 から始まる) が付けられます。メッセージは、print コマンド、または略して p で印刷できます。 p は表示されるヘッダーのリストを retain (または ignore) しますが、P print コマンドはすべてを表示します。ヘッダー; Sh ow コマンドは生のメッセージ コンテンツを出力します。

デフォルトでは、現在のメッセージ (ドット) が表示されますが、他の多くのコマンドと同様に、マニュアルのセクション mailx(1) § メッセージの指定 に記載されているように、メッセージのリストを指定することができます。たとえば、p:u はすべての未読メッセージを表示し、p. は現在のメッセージ (ドット) を出力し、p 1 5 はメッセージ 1 と 5 を出力します。 p-p+ は、それぞれ前のメッセージと次のメッセージを出力します。空行に単純に RETURN を入力すると、next (n) のように動作し、次のメッセージが出力されることに注意してください。

コマンド from は概要を表示するのに便利です。たとえば、f '@@arch linux は、メッセージ ヘッダーに文字列 'arch linux' を含むすべてのメッセージのヘッダー サマリーを出力します。一方、f '@arch linux は、件名に 'arch linux' が含まれるもののみに一致します。最後に、正規表現 f @^A[^[:space:]]+ は、件名が A 文字で始まり、A の直後に空白文字がないすべてのメッセージを検索します。検索式などに空白がある場合に必要になる場合があります。

  • file File 新しいメールボックスを開きます。後者は読み取り専用モードです
  • newmail (メールボックスに応じて、新しいメールをチェックし) 新しいメッセージのリストを出力します
  • he (headers) メッセージリストを再印刷します
  • z- z+ z0 z$ ヘッダー表示をスクロールします (使用している端末によっては、Home/End/PageUp/PageDown キーがエイリアスとして機能します)
  • folders 現在設定されている folder の下にあるメールボックスのリストを表示します
  • r 指定されたメッセージのすべての宛先に返信します
  • R 指定されたメッセージの送信者に返信します
  • Lreply 指定されたメッセージ "メーリングリスト" への返信
  • move または mv は (a) メッセージを移動します
  • (un)flag (a) 件のメッセージをフラグなし (未) としてマーク
  • new (a) 件のメッセージを未読にします
  • seen (a) 個のメッセージを既読にします
  • P (a) 個のメッセージをすべてのヘッダーとともに出力します
  • p (a) メッセージとすべての無視されないヘッダーを出力します
  • show (a) メッセージコンテンツの raw メッセージを出力します
  • write それか w メッセージと添付ファイルをネイティブ形式でローカルストレージにダウンロードする

メッセージの作成

作成は、mail user@host と入力するか、メッセージに返信することで開始されます。$EDITOR を入力すると (editalong が設定されていると仮定します) ネイティブエディタが表示され、チルダエスケープを使って多くの操作ができます (~? で短いヘルプが表示されます、 特に興味深いのは ~@ で、これは添付ファイルのリストを対話的に編集することができ、引数が与えられると、追加の添付ファイルを (n) (カンマで区切られたリスト) を追加できます。

メールを送信するには、Ctrl+d で EOT を送るか、 ~. を単独でタイプしてください。

S/MIME を使う

マニュアルには、証明書などの作成方法のステップバイステップの例 (mailx(1) § S/MIME で署名・暗号化されたメッセージ と同様に mailx(1) § S/MIME step by step) が記載されています。秘密鍵と署名された証明書がすでにあるとして、必要なペアファイルを作成するだけです。

# cat private-key.pem signed-certificate.pem > ~/pair.pem

S-nailをセットアップします

set smime-sign-cert=~/pair.pem \
    smime-sign-message-digest=SHA256 \
    smime-sign

今後、送信されるすべてのメッセージは署名されるようになります。デフォルトのメッセージダイジェストは、RFC:5751 で指定されているように SHA1 です。S/MIME は常に変数 from の設定に関連して動作するので、代わりに account に上記の設定を置くことが最善と思われます。verify コマンドは S/MIME メッセージを検証しますが、S/MIME の復号と検証は今のところ OpenSSL にのみ基づいており、単純な MIME 構造のメッセージにのみ対応していることに注意してください。

OpenPGP のサポート

S-nail は OpenPGP をサポートしていませんが、マクロを使うことで自動的に --clearsign されたメッセージを検証することができます。リソースファイルで以下を使うことで V を押すだけでメッセージを検証することが可能です:

 define V {
   localopts yes
   set pipe-text/plain="set -C;\
     : > \"${TMPDIR}/${NAIL_FILENAME_GENERATED}\";\
     trap \"rm -f \\\"${TMPDIR}/${NAIL_FILENAME_GENERATED}\\\"\" EXIT;\
     trap \"exit 75\" INT QUIT TERM;\
     set +C;\
     cat > \"${TMPDIR}/${NAIL_FILENAME_GENERATED}\";\
     < \"${TMPDIR}/${NAIL_FILENAME_GENERATED}\" awk \
         -v TMPFILE=\"${TMPDIR}/${NAIL_FILENAME_GENERATED}\" '\
       BEGIN {done=0}\
       /^-----BEGIN PGP SIGNED MESSAGE-----/,/^$/ {\
         if (done++ != 0)\
           next;\
         print \"--- GPG --verify ---\";\
         system(\"gpg --verify \" TMPFILE \" 2>&1\");\
         print \"--- GPG --verify ---\";\
         print \"\";\
         next;\
       }\
       /^-----BEGIN PGP SIGNATURE-----/,/^-----END PGP SIGNATURE-----/ {\
         next;\
       }\
       {print}\
       '"
   print
 }
 define RK {
   !printf 'Key IDs to gpg --recv-keys: ';\
     read keyids;\
     gpg --recv-keys ${keyids};
 }
 ghost V call V
 ghost RK call RK

IMAP メールボックスを使う

以下は簡単なヒントです。たとえば、folderinbox を定義して IMAP サーバーフォルダーを指すようにすることもできます。 国際化された名前がサポートされています。

set v15-compat

# or many servers will expire the session
set imap-keepalive=240
set imap-cache=~/.imap_cache

# You may want to define shortcuts to folders, for example:
shortcut myimap "imaps://USER:PASS@server:port"
set inbox=myimap

参照