chr*_*onn 5 email smtp sendmail 20.04
我正在尝试使用 msmtp 作为系统配置来设置 Ubuntu 20.04。
我安装了 msmtp (v1.8.6-1) 和 heirloom-mailx (v12.5-2+deb7u1build0.14.04.1)。
配置文件/etc/msmtprc (chmod: 600) 有以下内容:
# Set default values for all accounts.
account default
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile /var/log/msmtp
# gmail
host smtp.gmail.com
port 587
from <account>@gmail.com
user <account>
password <password>
# Syslog logging with facility LOG_MAIL instead of the default LOG_USER
syslog LOG_MAIL
Run Code Online (Sandbox Code Playgroud)
日志文件/var/log/msmtp文件模式为 660。
文件/etc/mailrc (chmod: 600) 包含以下内容:
set sendmail="/usr/bin/msmtp"
Run Code Online (Sandbox Code Playgroud)
当我尝试使用 sendmail 从终端发送电子邮件时,我收到以下sendmail: account default not found: no configuration file available。
如果我直接调用 msmtp,也会出现同样的错误。
警告:我的建议基于 Debianmsmtp软件包。
推荐的修复:/etc/msmtprc由组拥有msmtp。
chown root:msmtp /etc/msmtprc
chmod 640 /etc/msmtprc
Run Code Online (Sandbox Code Playgroud)
说明: msmtp二进制安装为 set group ( msmtp) id
$ ls -l /usr/bin/msmtp
-rwxr-sr-x 1 root msmtp 139000 Aug 20 16:24 /usr/bin/msmtp
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4126 次 |
| 最近记录: |