首页 > 代码库 > macOS下用命令行发邮件

macOS下用命令行发邮件

brew install msmtp

vi ~/.mailrc
set sendmail=/usr/local/bin/msmtp
wq!

vi ~/.msmtprc

# Use an external SMTP server with insecure authentication.
# (manually choose an insecure authentication method.)
# Note that the password contains blanks.

defaults

####################################################################
# A sample configuration using sina.cn
####################################################################

account default
host smtp.sina.cn
port 25
from vincenthandsome@sina.cn
auth login
tls off
user vincenthandsome@sina.cn
password 2wsxzaq1
:wq!

chmod 600 ~/.msmtprc
echo "this‘s an apple." |mail 888888@qq.com
上述方法参考自https://my.oschina.net/uhziel/blog/186683

 

macOS下用命令行发邮件