Send mail using msmtp mutt Shell
1. Compile the software.
Software: http://sourceforge.net/projects/msmtp/files/msmtp/1.4.13/msmtp-1.4.13.tar.bz2/download
Tar jxvf msmtp-1.4.13.tar.bz2
./Configure -- prefix =/opt/msmtp
Make
Make install
2. Check where the configuration file is located.
[Root @ server bin] #./msmtp -- version
Msmtp version 1.4.13
TLS/SSL Library: None
Authentication Library: Built-in
Supported authentication methods:
Plain cram-md5 (external login)
IDN support: Disabled
NLS: enabled, localedir is/opt/msmtop/share/locale
System Configuration File Name:/opt/msmtp/etc/msmtprc ----- You need to manually create
User Configuration File Name:/root/. msmtprc
Copyright (c) 2007 Martin lambers and others.
This is free software. You may redistribute copies of it under the terms
The GNU General Public License.
There is no warranty, to the extent permitted by law.
3. Configure the msmtp configuration file.
[Root @ server] # mkdir-P/opt/msmtp/{etc, log}
[Root @ server] # cd/opt/msmtp/etc
[Root @ Server etc] # vi msmtprc (Add the following content)
# Set default values for all following accounts.
Ults
Logfile/opt/msmtp/log/msmtp. Log
# The SMTP server of the provider.
Account Sohu
Host smtp.sohu.com
From your_account@sohu.com
AUTH LOGIN
User your_account
Password your_password
# Set a default account
Account default: Sohu
Save and exit, and add the executable permission to this file: chmod + x msmtprc
When you get there, you 'd better test it first.
/Opt/msmtp/bin/msmtp test@gmail.com
Hello, test
CTRL + d
Tail-F/opt/msmtp/log/msmtp. log to check whether the operation is successful.
Then go to the preceding email to see if the email has been received.
4. Configure mutt
Download and install the mutt installation package: mutt-1.5.11.tar.gz
Tar-xzvf mutt-1.5.11.tar.gz
./Configure -- prefix =/opt/mutt & make install
[Root @ server bin] # vi/etc/muttrc (Add the following content)
Set Sendmail = "/opt/msmtp/bin/msmtp"
Set realname = "Actor"
Set use_from = Yes
Set Editor = "Vi"
5. Now we have everything done. Let's test it.
[Root @ server bin] # echo "test" | mutt-s "messages" test@gmail.com