原文地址 mutt+msmtp配置smtp tls starttls模式发邮件 - ismeoh Blog
- apt-get install msmtp mutt -y
- cd /root/
- vim .muttrc
- -----
- set sendmail="/usr/bin/msmtp"
- set use_from=yes
- #发件人名字
- set realname="Ryan Wang"
- #发件人地址
- set from=xxxxxxxxx@163.com
- set envelope_from=yes
-
- set charset="utf-8"
- set send_charset="utf-8"
- set content_type = "text/html\;charset=utf-8"
- ------
- # not necessary beacause already config when install smmtp
- sudo apt install msmtp ca-certificates
- vim ~/.msmtprc
- ------
- # Set default values for all following accounts.
- defaults
- auth on
- tls on
- tls_trust_file /etc/ssl/certs/ca-certificates.crt
- logfile ~/.msmtp.log
-
- # Gmail
- account gmail
- host smtp.gmail.com
- port 587
- from username@gmail.com
- user username@gmail.com
- password plain-text-password
-
- # Set a default account
- account default : gmail
- ---
- chmod 600` ~/.msmtprc
- # test
- echo "from shell" | msmtp -a default username@gmail.com