hack のためのネタ帳, etc,,,

SMTP client
NAS4Free-9.2.0.1.972 等のメール送信用に使われている。

公式ページ等

Tips

サーバー情報の表示

-S オプションを用いる。
# SMTP の場合
msmtp --host=SMTP_SERVER -S
# SMTPS (暗黙の SMTP over SSL, implicit mode) の場合
msmtp --host=SMTP_SERVER --port=465 -S --tls=on --tls-starttls=off --tls-trust-file=/etc/ssl/certs/ca-certificates.crt
# SMTP with STARTTLS (明示的な SMTP over SSL, explicit mode) の場合
msmtp --host=SMTP_SERVER --port=587 -S --tls=on --tls-starttls=on  --tls-trust-file=/etc/ssl/certs/ca-certificates.crt
サーバーの SSL 証明書に署名した認証局(CA)の公開鍵がない場合、
  • --tls-trust-file=/etc/ssl/certs/ca-certificates.crt
の代わりに
  • --tls-certcheck=off
もしくは、サーバーの SSL 証明書の fingerprint (-S --tls=on が成功すれば表示される)が分かる場合は
  • --tls-fingerprint=xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
を与える必要がある。
署名元の公開鍵がある場合は
  • --tls-trust-file=PATH_TO_CERTFILE
を与えても良い。

設定

設定ファイルのパーミッション

chmod で 600 に設定しておく必要がある。
touch ~/.msmtprc
chmod 600 ~/.msmtprc

SMTPS (暗黙の SMTP over SSL, implicit mode)

~/.msmtprc を以下のように設定する
account default
host smtp.example.com
port 465
user myusername
password mypassword
from myusername@example.com
tls on
tls_starttls off
tls_trust_file /etc/ssl/certs/ca-certificates.crt
#tls_certcheck off
auth on
logfile ~/.msmtp.log
正規認証局による署名のないSSL証明書の場合 tls_certcheck off をアンコメントする

SMTP with STARTTLS (明示的な SMTP over SSL, explicit mode)

~/.msmtprc を以下のように設定する
account default
host smtp.example.com
port 587
user myusername
password mypassword
from myusername@example.com
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
#tls_certcheck off
auth on
logfile ~/.msmtp.log
正規認証局による署名のないSSL証明書の場合 tls_certcheck off をアンコメントする
タグ

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

フリーエリア

管理人/副管理人のみ編集できます