最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
CentOS下安装sendmail组件并测试发送邮件
时间:2022-06-30 20:51:49 编辑:袖梨 来源:一聚教程网
安装sendmail
执行:
[root@vps478753 ~]# yum -y install sendmail
程序会自动搜索出sendmail安装程序自动安装。
安装好sendmail以后执行以下命令启动sendmail
[root@vps478753 ~]# service sendmail start
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
启动以后我们可以执行mail命令测试一下是否能发送邮件
一、通过文件内容发送邮件
首先创建一个body.txt
[root@vps478753 ~]# touch body.txt
写入内容
[root@vps478753 ~]# echo 'This is test mail'>body.txt
发送邮件
[root@vps478753 ~]# mail -s 'Test mail' [email protected] < body.txt不一会就收到邮件了
点击打开,正文内容就是body.txt的内容
This is test mail
二、使用管道符直接发送邮件内容
如果不想通过文件发送邮件内容也可以这么发送
[root@vps478753 ~]# echo "This is test mail" | mail -s 'Test mail' [email protected]
以上效果同文件发送邮件内容一样
如果提示mail: command not found
[root@vps478753 ~]# mail -s 'Test mail' [email protected] < body.txt
-bash: mail: command not found
那么就是没有安装mail命令,此时需要安装mail命令
[root@vps478753 ~]# yum install mailx -y
然后再重新发送以下邮件就好了!
特别注意,如果安装了防火墙,请添加如下规则:
iptables设定
# iptables -A INPUT -p tcp –dport 25 -j ACCEPT
# iptables -A INPUT -p udp –dport 25 -j ACCEPT
相关文章
- 学信网官方登录入口-个人学历学位认证查询系统 12-20
- 原神AKT资源站网页入口-AKT原神官网链接直达地址 12-20
- CET4准考证成绩防伪验证官方入口-CET4准考证成绩下载快速指南入口 12-20
- yandex网站突然打不开-俄罗斯搜索引擎最新可用入口2025 12-20
- cet4成绩快速查询入口-cet4成绩官方查询入口官网 12-20
- 抖币充值官网入口-抖币充值官网入口1:10 12-20