mail mailx 发送邮件
2017-02-28 15:15
225 查看
centos 7 x64
在这个系统中 mail 是 mailx 的一个符号链接,所以是一样的。
配置文件在 /etc/mail.rc 也可以在用户主目录下创建 ~/.mailrc
对当前用户优先使用 ~/.mailrc
连接 163 和 gmail 配置如下:
163
Gmail
发送示例:
echo “infos in body text” | mail -v -s “test-subject-text” -A cn163 destination@mail.com
echo “infos in body text” | mail -v -s “test-subject-text” -A gmailttls destination@mail.com
注意:
gmail 没有设置 2-step 验证的帐户需要打开
1 https://myaccount.google.com/security?pli=1
2 https://www.digitalocean.com/community/questions/unable-to-send-mail-through-smtp-gmail-com
3 https://www.google.com/settings/security/lesssecureapps
4 https://support.google.com/mail/answer/7126229?visit_id=1-636238617108087543-2247862638&rd=2#cantsignin
5 https://support.google.com/accounts/answer/6010255
6 http://www.systutorials.com/1411/sending-email-from-mailx-command-in-linux-using-gmails-smtp/
7 http://milejko.com/blog/mailx-using-gmail-smtp
在这个系统中 mail 是 mailx 的一个符号链接,所以是一样的。
配置文件在 /etc/mail.rc 也可以在用户主目录下创建 ~/.mailrc
对当前用户优先使用 ~/.mailrc
连接 163 和 gmail 配置如下:
163
account cn163 { set from=nickname<user@163.com> set smtp=smtp.163.com set smtp-auth=login set smtp-auth-user=user@163.com set smtp-auth-password=password }
Gmail
account gmailttls { set smtp-use-starttls set nss-config-dir=~/.mozilla/firefox/it-is-random-here.default/ set ssl-verify=ignore set from=nickname<user@gmail.com> set smtp=smtp://smtp.gmail.com:587 set smtp-auth=login set smtp-auth-user=user@gmail.com set smtp-auth-password=password }
发送示例:
echo “infos in body text” | mail -v -s “test-subject-text” -A cn163 destination@mail.com
echo “infos in body text” | mail -v -s “test-subject-text” -A gmailttls destination@mail.com
注意:
gmail 没有设置 2-step 验证的帐户需要打开
允许不够安全的应用:已启用。设置了 2-step 验证的参照 ref 4 使用 App password 验证。
1 https://myaccount.google.com/security?pli=1
2 https://www.digitalocean.com/community/questions/unable-to-send-mail-through-smtp-gmail-com
3 https://www.google.com/settings/security/lesssecureapps
4 https://support.google.com/mail/answer/7126229?visit_id=1-636238617108087543-2247862638&rd=2#cantsignin
5 https://support.google.com/accounts/answer/6010255
6 http://www.systutorials.com/1411/sending-email-from-mailx-command-in-linux-using-gmails-smtp/
7 http://milejko.com/blog/mailx-using-gmail-smtp
相关文章推荐
- SharePoint【ECMAScript对象模型系列】-- 12. 通过邮件发送带有Unique DocumentID的文档链接
- 使用JavaMail简单的发送邮件
- 用Spring让Java Mail支持简化邮件发送
- 邮件发送
- PHP一个发送邮件的类
- java web 邮件发送功能
- LNMP笔记:Centos下安装Postfix,替换sendmail发送邮件
- SMTP邮件格式、SMTP 协议,SMTP的MIME写法,SMTP发送HTML邮件
- 易宝典文章——玩转Office 365中的Exchange Online服务 之七 怎样新建Exchange Online用户,并实现邮件发送
- Linux下使用sendEmail发送带附件的邮件(转载)
- Ubuntu 中sendmail 的安装、配置与发送邮件的具体实现
- Asp环境下,用 C 写一个邮件发送组件如此简单[附源代码]
- 利用Apache commons-email组件发送邮件
- Python的SMTP邮件发送代码
- 检测环境中是否有core文件并自动发送邮件通知
- 工作小结 + 发布新的邮件发送工具
- 解决sendmail 不能发送邮件问题
- phpMailer在CentOS 6.5下无法发送邮件的解决办法
- JavaMail实现邮箱之间发送邮件功能
- asp.net中利用CDONTS发送邮件的列子