1.安装home-brew
1 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
如果安装提示error:
curl: (35) Server aborted the SSL handshake
解决方案:
1.不过安装前,因为OS X El Capitan引入了系统完整性保护机制,使用Homebrew的同学请在升级后执行
1 | sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local |
2.在命令中添加 –insecure
1 | /usr/bin/ruby -e "$(curl -fsSL --insecure https://raw.githubusercontent.com/Homebrew/install/master/install)" |
卸载命令
1 | sudo ruby -e "$(curl -fsSL --insecure https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" |
2.安装msmtp
1 | brew install msmtp |
3.配置*vi ~/.mailrc *
*粘贴 *
1 | set sendmail=/usr/local/bin/msmtp |
**
**
vi ~/.msmtprc
注意把邮件密码设置为你的邮箱密码
1 | defaults |
4.~/.msmtprc 需要设置正确的访问权限
1 | chmod 600 ~/.msmtprc |
5.发送邮件
echo ‘hello world’ | mail -s “Subject” 305897143@qq.com
mail -s “test mail” 305897143@qq.com < ./head.jpg
注:-s “Subject” 指修改标题 < ./head.jpg 重定向内容
其他
发送附件:
cat head.jpg| uuencode head.jpg | mail -s “test” 305897143@qq.com