Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Buadhai

macrumors 65816
Original poster
Jan 15, 2018
1,109
432
Korat, Thailand
I have MSMTP (a simple smtp client) running on four Raspberry Pies. It was easy to set up and runs fine on all of them.

I haven't had the same good luck trying to install and configure it on an M1 iMac. I'm sure I made a silly error somewhere. I'm hoping someone will spot my mistake.

The ~/.msmtprc (configuration) file looks like this:

Code:
# Generics
defaults
auth           on
tls            on
# tls_starttls   on
# following is different from ssmtp:
# tls_trust_file /etc/ssl/certs/ca-certificates.crt
# user specific log location, otherwise use /var/log/msmtp.log, however,
# this will create an access violation if you are user pi, and have not changes the access
rights


tls_fingerprint 7D:8B:CD:37:56:4D:10:A1:10:B3:<snip>


logfile        /opt/local/bin/msmtp


# byname  specifics
account        gmail
auth            plain
host            smtp.gmail.com
port            587
from           me@gmail.com
user           me
password     my_password


# Default
account default : gmail

The /etc/mail.rc looks like this:

Code:
set append dot save ask crt
ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via
set sendmail=/opt/local/bin/msmtp

The only thing I added there was the "set sendmail" line.

When I run "mail" I can compose a message and appear to send it. But, it goes nowhere and there are no entries in the log file:

</opt/local/bin/msmtp>

Obviously, I've done something wrong. What it is?
 

Buadhai

macrumors 65816
Original poster
Jan 15, 2018
1,109
432
Korat, Thailand
Here's what the problem was. When I installed msmtp and mailutils I ended up with two mail binaries:

Code:
Valentine:~ mnewman$ which -a mail
/opt/local/bin/mail
/usr/bin/mail

Turns out that msmtp works with the latter, but not with the former:

Code:
Valentine:~ mnewman$ /opt/local/bin/mail mgnewman@mac.com
Cc:
Subject: none
test
msmtp: no recipients found
Sending data to /opt/local/bin/msmtp failed: Process exited with a non-zero status
cannot send message: Process exited with a non-zero status
Valentine:~ mnewman$ /usr/bin/mail mgnewman@mac.com
Subject: none
test
EOT

This is not a problem with shell scripts because I generally include the full path to binaries. However, on the command line it was a problem because of the way the path was set up. Just entering "mail" linked to the mail binary that doesn't work. I fixed that by creating an alias for mail that points to the correct binary.

Problem solved, but mystery remains. Why does msmtp work with the BSD version of mail (/usr/bin/mail) but not with the GNU version of mail (/opt/local/bin/mail)?
 
  • Like
Reactions: ratsg
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.