0

I'd like to send a mail when a user authenticates on a Debian 9 server. I use OVH mail server. I've set up msmtp like so :

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

I tried to send a mail with :

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

But didn't work, nothing happens. Same for the command :

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

EDIT 1

I tried the command proposed by @Anfi in the comments and I get :

-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)
Ror
  • 111
  • 2
  • 12
  • Try the following test command: `(subject: test; echo; echo "Hello this is sending email using msmtp)" | msmtp -i -v otheruser@mydomain.com` – AnFi Nov 07 '19 at 10:44
  • @AnFi I tried and got : `msmtp: the server sent an empty reply msmtp: could not send mail (account default from /home/myuser/.msmtprc)` – Ror Nov 07 '19 at 10:56

2 Answers2

0

Problem is in tls_starttls.

You have to disable certification file and set

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
mforsetti
  • 2,488
  • 2
  • 14
  • 20
0

All right, I got it. I needed to add this to the conf file:

tls on
tls_certcheck off

The mail works, but I get

<-- 250-AUTH LOGIN PLAIN

Not sure if this is really secure then

Ror
  • 111
  • 2
  • 12