The msmtp MTA can store credentials in OS X Keychain, if it was compiled with --with-macosx-keyring
option. (See, for example, msmtp on MacPorts.)
To use this functionality, create a keychain item named smtp://<smtp-host>
of kind "Internet password" (replacing <smtp-host>
with your SMTP server's address):
Name: smtp.freemail.example Kind: Internet password Account: joe.smith Where: smtp://smtp.freemail.example