Theory Introduction :
1. Mutt Introduction:
Mutt is a small but very powerful text-based mail client for Unix operating systems.
in simple terms, Mutt is a MUA (mail user agent), similar to Foxmail and Outlook, is not responsible for sending incoming messages.
2 . msmtp Introduction:
MSMTP is an SMTP client.
In the default mode, it transmits a mail to an SMTP server (for example at a free mail provider) which takes care of Furth ER delivery.
To use the this program with the Your Mail user agent (MUA), create a configuration file with the your mail account (s) and the Tell your M UA to call Msmtp instead of/usr/sbin/sendmail.
Translate only the second part "in order to use this program through MUA, you should create a profile using your account and tell the MUA program to call it instead of using the default SendMail"
Practical Operation :
First, MSMTP settings
Installation: Apt-get Install MSMTP
Configuration file Location:/ETC/MSMTPRC
Configuration file MSMTPRC
Defaults
TLS on #这三行都是开始邮件的tls认证的
Tls_starttls on
Tls_trust_file/etc/ssl/certs/ca-certificates.crt
Account Default
Host smtp.exmail.qq.com #smtp服务器地址和端口
Port 587
Auth Plain #使用明文方式的授权信息
User # "Your e-mail account"
Password # "password"
From # "Sender information [same as account name]
Timeout Ten #设置网络超时
Logfile/tmp/msmtp.log #日志
Second, Mutt set
Installation: Apt-get Install Mutt
Configuration file Location:/ETC/MUTTRC
Configuration file: Muttrc
Set sendmail= "/usr/bin/msmtp" #使用msmtp发送邮件
Set Use_from=yes #设置邮件包含from的header信息
Set realname= "Honey" #设置发送邮件的用户名 [alias/nickname of account]
Set editor= "Vim" #使用vim启动mutt交互模式
Set [email protected] #设置邮件from信息 [Use_from must be set]
Set Envelope_from=yes
Set Copy=no #是否保留消息副本
Third, mutt command line use
Example:
echo "For details see attachment" |mutt-a/root/a.txt-s "Daily Order Statistics"-c [email protected] \
--[email protected], [email protected]
Explain:
echo content is message body content
-a added attachment
-S Message subject
-C CC Mail person
"--" after "The content is the recipient" here because of newline, so add double bars "
This article is from the "learning is not transcribed" blog, please be sure to keep this source http://istyle.blog.51cto.com/6152438/1782680
Use MUTT+MSMTP to send mail under Ubuntu