命令行发送邮件并修改发送人,避免自动邮件归置到垃圾邮件
来源:互联网 发布:jenkins自动化部署php 编辑:程序博客网 时间:2024/06/11 07:34
1.安装home-brew
/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的同学请在升级后执行
sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local
2.在命令中添加 --insecure
/usr/bin/ruby -e "$(curl -fsSL --insecure https://raw.githubusercontent.com/Homebrew/install/master/install)"卸载命令
sudo ruby -e "$(curl -fsSL --insecure https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
2.安装msmtp
brew install msmtp
3.配置
4.~/.msmtprc 需要设置正确的访问权限
vi ~/.mailrc
粘贴
set sendmail=/usr/local/bin/msmtp
vi ~/.msmtprc
注意把邮件密码设置为你的邮箱密码
defaultslogfile ~/.msmtp.logaccount honglili@sohu-inc.comhost mail.sohu-inc.comport 25auth loginfrom honglili@sohu-inc.comuser honglili@sohu-inc.compassword *******# this next line is crucial: you have to point to the correct security certificate for GMail.# If this doesn't work, check the mstmp documentation# at http://msmtp.sourceforge.net/documentation.html for help## This next line should all be on one long line:#tls_trust_file /path/to/Thawte Roots/Thawte SSLWeb Server Roots/thawte Premium Server CA/Thawte Premium Server CA.pem# Set a default account# You need to set a default account for Mailaccount default : honglili@sohu-inc.com# end msmtprc
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
1 0
- 命令行发送邮件并修改发送人,避免自动邮件归置到垃圾邮件
- spring 发送邮件 发送人直接为中文名
- 用linux mail命令发送邮件时指定发送人
- 邮件附件乱码、设置邮件回复人、设置邮件发送人收件人姓名、发送现有的eml文件
- exchange 2007 smtp发邮件正常,使用owa发送邮件失败,邮件自动保存到草稿箱
- Ubuntu Linux自动发邮件配置及邮件发送脚本
- CMD Telnet 命令行自动发送邮件脚本
- 命令行发邮件
- 命令行发邮件
- 命令行发邮件
- 命令行发邮件
- Javamail发送邮件后并保存邮件到已发送
- 邮件营销:如何避免被误认为垃圾邮件
- 自动模拟邮箱登陆并发送邮件
- mysql自动备份数据库并发送邮件
- 自动生成awr报告并发送邮件
- 命令行方式 发送 邮件
- 命令行邮件发送工具
- 监听本地URL请求(NSURLProtocol)
- Java简单的网络爬虫实现
- 基于zepto的移动端弹出窗口插件
- 详解 UIView 的 Tint Color 属性
- React 复合组件
- 命令行发送邮件并修改发送人,避免自动邮件归置到垃圾邮件
- 使用 Microsoft Symbol Server 获取调试符号文件
- android广播
- Java实现几种常见排序方法
- gsoap开发之旅(1)
- 【OSGI】3.实战OSGI-翻译助手项目01
- 实战 Lucene,第 1 部分: 初识 Lucene
- 如何在mac本上安装android sdk
- Starting MySQL. ERROR! The server quit without updating PID file