6

I've been trying to send mail with msmtp with no success

Configuration file: ~/.msmtprc

defaults
auth           on
tls            on
tls_trust_file /etc/ssl/certs/ca-bundle.crt
logfile        ~/.msmtp.log

account iisr
host smtp.yandex.com
port 465
user info@iisr.mu
from info@iisr.mu
password ********

when testing it with the command echo "hello there username." | msmtp -a iisr noorani.bakerally@gmail.com, no results at all, neither in the log file,

using the script by @Andrezj in the answer below I get the following output and it stays like this:

ignoring system configuration file /etc/msmtprc: No such file or directory
loaded user configuration file /home/bakenoor/.msmtprc
using account iisr from /home/bakenoor/.msmtprc
host                  = smtp.yandex.com
port                  = 465
timeout               = off
protocol              = smtp
domain                = localhost
auth                  = choose
user                  = info@iisr.mu
password              = *
passwordeval          = (not set)
ntlmdomain            = (not set)
tls                   = on
tls_starttls          = on
tls_trust_file        = /etc/ssl/certs/ca-bundle.crt
tls_crl_file          = (not set)
tls_fingerprint       = (not set)
tls_key_file          = (not set)
tls_cert_file         = (not set)
tls_certcheck         = on
tls_force_sslv3       = off
tls_min_dh_prime_bits = (not set)
tls_priorities        = (not set)
auto_from             = off
maildomain            = (not set)
from                  = info@iisr.mu
dsn_notify            = (not set)
dsn_return            = (not set)
keepbcc               = off
logfile               = /home/bakenoor/.msmtp.log
syslog                = (not set)
aliases               = (not set)
reading recipients from the command line and the mail

any idea why the mail is not being sent ?

1
  • 4
    My configuration for smtps (port 465) works with tls_starttls off. – AnFi Jan 24 '15 at 17:55
5

Configuration

For SMTP port 465, ensure the Start TLS option is off in the $HOME/.msmtprc file:

defaults
auth           on
tls            on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile        /tmp/msmtp.log

account        ACCOUNT
host           mail.host.com
port           465
from           account@host.com
user           account@host.com
password       PASSWORD
tls_starttls   off

account default : ACCOUNT

Also ensure the file permissions are restricted to the user:

chmod 600 $HOME/.msmtprc

Debugging msmtp email sending

Use the following test script to get full transcript of SMTP session

#!/bin/sh
# msmtp specific options
# -d : debug
# -a : account name
# sendmail compatibility options
# -i : ignored for sendmail capability
# -t : Read recipient addresses from the To, Cc, and Bcc headers 
msmtp -d -a iisr -i -t <<END
From: info@iisr.mu
To: info@iisr.mu
Subject: test

test
END

Related

For details, see the following:

0
0

On CentOS 7.3 behind a firewall, My /etc/msmtprc:

defaults
logfile /var/log/msmtp.log
domain localhost
auth on
port 465
host smtp.gmail.com
tls on
tls_starttls off
auth on
tls_trust_file /etc/ssl/certs/ca-bundle.crt
# gmail account
account workflow
user *workflow@mydomain.com*
from *workflow@mydomain.com*
password *mypassword*
# set default account to use
account default : workflow
2
  • 1
    Are you suggesting this is the solution to the problem? With the scant explanation, it's difficult to tell exactly what you're trying to say. – music2myear Jan 13 '18 at 0:58
  • I was able to get it to work with the above configuration, so yes, it's my solution. Sorry about not being clear. Also, to note, I used the alternatives command to setup msmtp as the default for sending mail. Initially msmtp wasn't in the mta list, but I made the modification described here: bugzilla.redhat.com/show_bug.cgi?id=1367858 so msmtp would appear in the list. – Douglas Russell Jan 16 '18 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.