Centos7下使用mail发送邮件
首先检测相关服务是否已安装
[root@ProxyServer ~]# rpm -qa|grep mail
libreport-plugin-mailx-2.0.9-19.el6.x86_64
mailx-12.4-7.el6.x86_64
procmail-3.22-25.1.el6.x86_64
mailcap-2.1.31-2.el6.noarch
sendmail-8.14.4-8.el6.x86_64
若服务未安,则执行以下命令进行服务安装
[root@ProxyServer ~]# yum install sendmail
[root@ProxyServer ~]# yum install mailx –y
[root@ProxyServer ~]# yum update libreport-plugin-mailx
[root@ProxyServer ~]# yum -y install sharutils
[root@ProxyServer ~]# yum install mutt
修改配置文件,配置邮件相关内容(追加到配置文件末尾)
[root@ProxyServer ~]# vi /etc/mail.rc
set from=lvyf0802@163.com #之前设置好的邮箱地址
set smtp=smtp.163.com #邮件服务器
set smtp-auth-user=lvyf0802@163.com #之前设置好的邮箱地址
set smtp-auth-password=lvyf0802 #授权码
set smtp-auth=login #默认login
邮箱开启smtp服务(这里以163邮箱为例)


检测服务是否安装成功
[root@ProxyServer ~]# touch /usr/mail.txt
[root@ProxyServer ~]# mail -s "theme" test@163.com < /usr/mail.txt
//使用上面的命令就可把mail.txt文件的内容发给 test@163.com(-s “theme” 为邮件的主题)
为了防止垃圾邮件泛滥,阿里云服务器已不再开放smtp邮件的25端口,现在需要使用465端口进行smtp邮件发送。
生成密钥
[root@ProxyServer ~]mkdir -p /root/.certs/
echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs/./ -i 163.crt
certutil -L -d /root/.certs
2.配置密钥(红色代表修改内容)
[root@ProxyServer ~]# vi /etc/mail.rc
set bsdcompat
set from=lvyf0802@163.com #之前设置好的邮箱地址
set smtp=smtps://smtp.163.com #邮件服务器
set smtp-auth-user=lvyf0802@163.com #之前设置好的邮箱地址
set smtp-auth-password=lvyf0802 #授权码
set smtp-auth=login #默认login
set ssl-verify=ignore #ssl认证方式
set nss-config-dir=/root/.certs #证书所在目录
---------------------
作者:万一起飞了呢
来源:CSDN
原文:https://blog.csdn.net/lyf844692713/article/details/81479066
版权声明:本文为博主原创文章,转载请附上博文链接!
Centos7下使用mail发送邮件的更多相关文章
- Centos7下使用mail发送邮件配置
参考文档:https://blog.csdn.net/lyf844692713/article/details/81479066 安装环境查看 查看服务是否安装 rpm -qa|grep mail 如 ...
- Linux下使用mail发送邮件
邮件常常是Linux下监控报警手段之一.Linux下的mail命令可以方便,快速的完成发送邮件.下面以CentOS为例 1.安装 [root@vm8028 ~]# mail -bash: mail: ...
- Linux系统下使用 mail 发送邮件
邮件常常是Linux下监控报警手段之一.Linux下的mail命令可以方便,快速的完成发送邮件.下面以CentOS为例 1.安装: [app@127-0-0-1 ~]# mail -bash: mai ...
- linux下用mail发送邮件
利用外部邮箱发送邮件的方法 bin/mail会默认使用本地sendmail发送邮件,这样要求本地的机器必须安装和启动Sendmail服务,配置很麻烦,并且会带来不必要的 资源占用.而通过改动配置文件能 ...
- centos7下源码方式安装gitlab8.9+发送邮件+ldap
CentOS7下源码方式安装gitlab 环境描述 操作系统: centos7 redis: >=2.8 mysql >=5.5.14 git >=2.7.4 架构设计 一台gitl ...
- Linux下使用mail命令发送邮件
因为需要经常备份网站的数据,所以了解并学习了下linux下如何通过shell来发送邮件,这里以CentOS为例,使用mail命令来进行外部邮件的发送.mail命令的语法如下: Usage: mail ...
- linux下使用自带mail发送邮件
linux下使用自带mail发送邮件 mailx工具说明: linux可以通过安装mailx工具,mailx是一个小型的邮件发送程序,一般可以通过该程序在linux系统上,进行监控linux系统状态并 ...
- Ubuntu下使用mail命令发送邮件
Ubuntu下使用mail命令发送邮件 mail命令在Ubuntu下是需要安装的,使用下条命令进行安装: sudo apt-get install heirloom-mailx 接下来输入用户密码,等 ...
- Linux下配置mail使用外部SMTP发送邮件
修改/etc/mail.rc,增加两行:指定外部的smtp服务器地址.帐号密码等. # vi /etc/mail.rc set from=demo@qq.com smtp=smtp.qq.com se ...
随机推荐
- grep/字符/次数匹配/锚定符/小大括号/wc/tr/cut/sort/uniq
grep:正则表达式,文本过滤工具,能够实现以指定的"模式(Pattern)"逐行搜索文件中的内容,并将匹配到的行显示出来. 模式:是由正则表达式的元字符,其他字符组合起来的匹配字 ...
- mysql 数据库存储路径更改
使用了VPS一段时间之后发现磁盘空间快满了.本人的VPS在购买的时候买了500gb的磁盘,提供商赠送了20GB的高性能系统磁盘.这样系统就有两个磁盘空间了.在初次安装mysql 的时候将数据库目录安装 ...
- //*[starts-with(@class,'btn')][text()='差'] 正则定位元素
starts-with? //*[starts-with(@class,'btn')][text()='差'] 意思找从头开始的这个class
- win10,ubuntu时间不对问题
sudo apt-get install ntpdate sudo ntpdate time.windows.com # ntp2.aliyun.com 然后将时间更新到硬件上: sud ...
- ctf-misc-图片隐写术套路总结
1.直接右键notepad打开,搜索flag,如果图片很多的话,可以写py脚本也 可以打开后搜索全部打开文件 2.是一个压缩包,改了后缀 3.图片中藏了一个二维码,用Stegsolve加几次滤镜 ...
- Android呼吸灯添加
平台:mtk 一.hal层入口 Lights.c (vendor\mediatek\proprietary\hardware\liblights) char const*const RE ...
- phpstorm里面添加swoole代码提示
https://yq.aliyun.com/articles/44246 下载代码: git clone https://github.com/eaglewu/swoole-ide-helper.gi ...
- [从源码学设计]蚂蚁金服SOFARegistry网络操作之连接管理
[从源码学设计]蚂蚁金服SOFARegistry网络操作之连接管理 目录 [从源码学设计]蚂蚁金服SOFARegistry网络操作之连接管理 0x00 摘要 0x01 业务领域 1.1 应用场景 0x ...
- leetcode 练习--反转链表
最近开始学习数据结构和算法的学习,也自然开始在 leetcode 上练习,所以每周大概会分享做过的leetcode 练习,尽量做到每天更新一道题目. 作为 leetcode 练习笔记的第一道题目,选择 ...
- @Async失效之谜
@Async如何使用 异步的方法上加上@Async异步注解 启动类中需要加上@EnableAsync才有效 使用时类似于下列函数: new Thread(()-> System.out.prin ...