Reprinted from: http://blog.csdn.net/psh2009/article/details/9280713
Tried a lot of methods, this one really works, thank you. The following is reproduced.
The article mainly refers to http://www.cnblogs.com/276815076/archive/2011/10/11/2207214.html
The verification is sent successfully, please try boldly, but the consequences are at your own risk .
Needless to say, install the software first, everyone knows about ubuntu, fool sudo apt-get install mutt msmtp, everything is set by default.
Then start various configurations, very simple, don't want trouble, you can copy, of course, I also ctrl+c
The MUTT
system is set globally in /etc/Muttrc. If a system user is used, it can be set in ~/.muttrc.
vi .muttrc
set sendmail="/usr/bin/msmtp"
set use_from=yes
set realname="FengYuBin"
set [email protected]
set envelope_from=yes
creates ~/.msmtprc and ~/.msmtp.log, which are configuration and log files, respectively.
vi .msmtprc
account default
host smtp.163.com
auth plain
chmod 600 .msmtprc
Type the following command: msmtp --host=smtp.163.com --serverinfo and press Enter
SMTP server at smtp.163.com (m5-86.163.com [202.108.5.86]), port 25:
163.com Anti-spam GT for Coremail System (163com[20050206])
Capabilities:
PIPELINING:
Support for command grouping for faster transmission
AUTH:
Supported authentication methods:
PLAIN LOGIN
At this point, you can use mutt to send mail, let's test it.
echo "test" |mutt -s "my_first_test" ***@gmail.com
Go to the mailbox to see if it is successful!
Finally, if you want to append the contents of the file to the email, you can use mutt -s "my_first_test" ***@gmail.com < test.txt
If you want to add it as an attachment, because it is not needed for the time being, please Baidu.