Email

msmtp 和 OVH 郵件

  • April 2, 2022

當使用者在 Debian 9 伺服器上進行身份驗證時,我想發送一封郵件。我使用 OVH 郵件伺服器。我已經像這樣設置了 msmtp:

account myaccount
tls_starttls off
logfile ~/.msmtp.log

host ssl0.ovh.net
port 465
from user@mydomain.com
auth on
user user@mydomain.com
password XXXXXXXXXXXXXXXX

account default : myaccount

我嘗試發送郵件:

echo "Hello this is sending email using msmtp" | msmtp otheruser@mydomain.com

但是沒有用,什麼也沒有發生。命令相同:

msmtp --serverinfo --tls --tls-certcheck=off --host ssl0.ovh.net --port 465

編輯 1

我在評論中嘗試了@Anfi 提出的命令,我得到:

-bash: subject:: command not found
ignoring system configuration file /etc/msmtprc: No such file or directory
loaded user configuration file /home/myuser/.msmtprc
falling back to default account
using account default from /home/myuser/.msmtprc
host = ssl0.ovh.net
port = 465
proxy host = (not set)
proxy port = 0
timeout = off
protocol = smtp
domain = localhost
auth = choose
user = user@mydomain.com
password = *
passwordeval = (not set)
ntlmdomain = (not set)
tls = off
tls_starttls = off
tls_trust_file = (not set)
tls_crl_file = (not set)
tls_fingerprint = (not set)
tls_key_file = (not set)
tls_cert_file = (not set)
tls_certcheck = on
tls_min_dh_prime_bits = (not set)
tls_priorities = (not set)
auto_from = off
maildomain = (not set)
from = user@mydomain.com
add_missing_from_header = on
add_missing_date_header = on
remove_bcc_headers = on
dsn_notify = (not set)
dsn_return = (not set)
logfile = /home/myuser/.msmtp.log
syslog = (not set)
aliases = (not set)
reading recipients from the command line
msmtp: the server sent an empty reply 
msmtp: could not send mail (account default from /home/myuser/.msmtprc)

好吧,我明白了。我需要將其添加到 conf 文件中:

tls on
tls_certcheck off

郵件有效,但我得到

<-- 250-AUTH LOGIN PLAIN

不確定這是否真的安全

問題在tls_starttls.

您必須禁用認證文件並設置

account MyAccount
tls on
tls_certcheck off
tls_starttls off
host ssl0.ovh.net
port 465
from user@domain
user user@domain
password UserPassword
# Set a default account
account default : MyAccount

引用自:https://serverfault.com/questions/990944