当前位置:网站首页>Sendmail无法发送邮件及发送过慢解决
Sendmail无法发送邮件及发送过慢解决
2022-07-03 13:53:00 【星哥玩云】
今天折腾CentOS的时候Sendmail碰到的一些问题,如邮件无法发送,发送后的一些问题等等,这里统一做个记录,以备不是之需,同时也希望能帮到一些碰到这些问题的童鞋。每个问题都会有详细的操作步骤,按照步骤操作即可;
折腾环境: CentOS 邮件组件:Sendmail
一、主机虽支持mail()函数,却无法发送邮件; 先使用以下命令检查是否已安装sendmail:
rpm –q sendmail检测结果确实未安装该组件,果断安装:
yum install sendmail等待安装完成后去检查了下php.ini配置,里面需要修改相关参数,直接:
vi /usr/local/php/etc/php.ini找到 sendmail_path 所在行,发现是未启用,去掉前面的分号;(按i编辑模式),去掉分号,并将其改为:
sendmail_path = /usr/sbin/sendmail -t –i这个有的默认就会是这个值。接着重启sendmail:
service sendmail restart二:发送邮件过慢问题 上面的步骤已经可以正常发送邮件了,但是却发现发送过慢,此时,请检查hosts:
cat /etc/hosts结果发现:
127.0.0.1 localhost.localdomain localhost中并没有hostname,将其加入,查看主机名称直接命令:hostname ,这里加入主机名称为:testhost,则改过后的内容则为:
127.0.0.1 localhost.localdomain localhost testhost接着,重启sendmail;
完成此步骤后还可以解决一个sendmail和sm-client启动慢的问题;
三、邮件发送方为:[email protected]代发问题
方法一:修改hostname为个人域 方法二:伪装成[email protected]
执行以下命令:
/etc/mail/sendmail.mc打开后编辑文件,在末端加入以下内容:
MASQUERADE_AS(gongzi.me)dnl FEATURE(masquerade_envelope)dnl FEATURE(masquerade_entire_domain)dnl MASQUERADE_DOMAIN(gongzi.me)dnl将其中的gongzi.me换成你自己的域名,然后保存。接着执行以下命令:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf而后,重启sendmail服务。
四:执行 m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf 时,报错:sendmail.mc:10: m4: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory,并且导致sendmail相关服务无法正常启动。
原因:未安装sendmail-cf 解决:执行以下命令:
yum install sendmail-cf完成后问题解决。
有别的再陆续补充!
边栏推荐
- Collection of mobile adaptation related articles
- “又土又穷”的草根高校,凭什么被称为“东北小清华”?
- Eight sorts
- 叶酸修饰的金属-有机骨架(ZIF-8)载黄芩苷|金属有机骨架复合磁性材料([email protected])|制备路线
- JVM垃圾回收机
- Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content
- Dlopen() implements dynamic loading of third-party libraries
- Function calling convention
- Common mixins
- JVM class loading
猜你喜欢

常见问题之PHP——ldap_add(): Add: Undefined attribute type in

Exercise 8-8 moving letters

Uniapp tips - scrolling components

x86汇编语言-从实模式到保护模式 笔记

JVM object lifecycle

Interface for querying IP home

QT learning 23 layout manager (II)

Leetcode (4) -- find the median of two positively ordered arrays

可编程逻辑器件软件测试

Programmable logic device software testing
随机推荐
UiO-66-COOH装载苯达莫司汀|羟基磷灰石( HA) 包裹MIL-53(Fe)纳米粒子|装载黄芩苷锰基金属有机骨架材料
JS shift operators (< <,> > and > > >)
The small project (servlet+jsp+mysql+el+jstl) completes a servlet with login function, with the operation of adding, deleting, modifying and querying. Realize login authentication, prevent illegal log
中感微冲刺科创板:年营收2.4亿净亏1782万 拟募资6亿
7-7 12-24 hour system
金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
How to bold text in AI
JVM runtime data area
6-9 statistics of single digits (15 points)
Redis: redis data structure and key operation commands
剑指 Offer 28. 对称的二叉树
Dlopen() implements dynamic loading of third-party libraries
jvm-类加载
Eight sorts
虽然不一定最优秀,但一定是最努力的!
C language,%d% Difference between 2D%2d%02d
Global event bus
Exercise 10-8 recursive implementation of sequential output of integers
必贝特医药冲刺科创板:年营收97万亏损1.37亿 拟募资20亿
QT learning 25 layout manager (4)