#author("2020-11-02T08:42:33+00:00","default:src128","src128")
#author("2020-11-03T07:56:54+00:00","default:src128","src128")
&tag(msmtp);
*目次 [#fc188e5e]
#contents
*関連ページ [#u9ef137d]
-[[ssmtp]]

*参考情報 [#o2483a77]
-[[msmtp - about:https://marlam.de/msmtp/]]
-[[msmtpで外部のSMTPサーバを利用してメール送信する - longkey1's blog:https://blog.longkey1.net/2018/12/22/msmtp-with-external-smtp-server/]]

*インストール [#c11ac9ff]
-CentOS8の場合以下のコマンドでインストールできる。
 dnf install msmtp

*設定ファイルの作成 [#uf928009]
-/etc/msmtprcまたは~/.msmtprc
-/usr/share/doc/msmtp/msmtprc-user.exampleをコピーして使う。
#pre{{
# default value
defaults
port 587
tls on
tls_trust_file /etc/ssl/certs/ca-bundle.crt
syslog on
aliases /etc/aliases

# account settings
account	mymail
host smtp.freemail.example
from joe_smith@freemail.example
account myaccount
host example.com
port 587
from test@example.com
auth on
user joe.smith
password secret123
user testuser
password testpass

# smtp server settings
account isp
host mail.isp.example
from smithjoe@isp.example
auth on
user 12345

# Set a default account
account default : mymail

account default : myaccount
}}
-以下のコマンドでテストできる。この場合デフォルトの「myaccount」を使ってfoo@bar.comにメールが送られる(Fromなどもそれになる)。
 echo -ne "Subject: test mail 4 \n\nhello test mail" | msmtp -a default foo@bar.com  
-/etc/aliasesで「root: foo@bar.com」と設定しておくと、以下のようなコマンドでも同様。
 echo -ne "Subject: test mail 4 \n\nhello test mail" | msmtp -a default root
-「-a」を省略するとデフォルトのアカウントが使われる。
 echo -ne "Subject: test mail 4 \n\nhello test mail" | msmtp root



トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS