LoginSignup
1
0

More than 3 years have passed since last update.

debianのmsmtpで認証はOnにしてセキュリティはOffにする方法

Last updated at Posted at 2020-06-08

はじめに

Dockerでレンタルサーバのような開発環境を作成したい。

Docker HubにあるPHP-Apacheは、Debianで構築されている。

centOSだと、ssmtpなのだが、Debianだとmsmtpが使うようだ。

msmtpでTLSなどの暗号化はオフにして、SMTP Authだけ使いたい場合の設定がわからなかった。

問題点

/etc/msmtprcでAuth Onに設定するとどうしても、暗号化の指定も行われてしまう。

# A system wide configuration file is optional.
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
account default

# The SMTP smarthost
host maildev(Dockerで構築しているメールキャッチャーのホスト)

port 25
auth on
tls off
tls_starttls off
user smtpuser
password smtppassword

# Construct envelope-from addresses of the form "user@oursite.example"
# auto_from on
#maildomain oursite.example
from test@web


# Syslog logging with facility LOG_MAIL instead of the default LOG_USER
# syslog LOG_MAIL
logfile /var/log/msmtp.log

このように設定をした場合に、
msmtp.logに以下のようなエラーが出力されてメールが送信されない。

Jun 08 12:59:26 host=maildev tls=off auth=on user=smtpuser from=test@web recipients=***@example.com,***@gmail.com errormsg='cannot use a secure authentication method' exitcode=EX_UNAVAILABLE

解決策

auth loginにする必要があった。
これでメールが送信された。

# A system wide configuration file is optional.
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
account default

# The SMTP smarthost
host maildev(Dockerで構築しているメールキャッチャーのホスト)

port 25
auth login <= ここを変更
tls off
tls_starttls off
user smtpuser
password smtppassword

# Construct envelope-from addresses of the form "user@oursite.example"
# auto_from on
#maildomain oursite.example
from test@web


# Syslog logging with facility LOG_MAIL instead of the default LOG_USER
# syslog LOG_MAIL
logfile /var/log/msmtp.log

参考URL

1
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
1
0