I recently installed both msmtp (smtp client) and mailutils on an M1 iMac via MacPorts. I couldn't get msmtp to work until I realized that there were two mail binaries on the machine, one that, I guess, is native and one installed by mailutils:
Valentine:~ mnewman$ which -a mail
/opt/local/bin/mail
/usr/bin/mail
Unfortunately, the wrong one was being used if I tried to send mail from the Command line which caused msmtp to fail. I tried to fix it with:
Valentine:~ mnewman$ alias mail="/usr/bin/mail"
Valentine:~ mnewman$ type mail
mail is aliased to `/usr/bin/mail'
Which works, but I think there must be a better way. Is there?
Edited to show why I need to use /usr/bin/mail rather than /opt/local/bin/mail with msmtp:
Valentine:~ mnewman$ /opt/local/bin/mail me@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 me@mac.com
Subject: none
test
EOT
/opt/local/bin/mail fails while /usr/bin/mail works
Asked by Buadhai
(681 rep)
Aug 22, 2022, 09:28 AM
Last activity: Aug 24, 2022, 01:12 PM
Last activity: Aug 24, 2022, 01:12 PM