centos sendmail?centos远程桌面软件
其实centos sendmail的问题并不复杂,但是又很多的朋友都不太了解centos远程桌面软件,因此呢,今天小编就来为大家分享centos sendmail的一些知识,希望可以帮助到大家,下面我们一起来看看这个问题的分析吧!
Centos系统sendmail发送邮件很慢怎么办
安装sendmail服务器的很简单,只需输入以下命令即可:
yum install sendmail
这个时候依然无法发邮件,还得修改一下php.ini的配置,调用sendmail功能
第一步:输入 vi/usr/local/php/etc/php.ini
第二步:找到有关sendmail_path的那一行,按i键,然后就可以修改代码了,
第三步:去掉行首注释(分号;),并改成:sendmail_path=/usr/sbin/sendmail-t–i
第四步:按 Esc键——shift+q——wq(保存退出的意思)
第五步:重启vps 命令: reboot
重启完毕后可以发邮件了,但速度很慢,此时可以输入如下命令查看一下解析文件:cat/etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
199.193.248.26 wenran
因为sendmail监听的是127.0.0.1,但却无法确认主机名weimtv(因为在服务器上/etc/sysconfig/network文件里记录的HOSTNAME是 wenran),所以发送邮件就非常慢了。那么我就把 wenran这个主机名同时也加到127.0.0.1上面,变成:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost wenran
199.193.248.26 wenran
修改方法依然是用vi命令,
然后重启sendmail服务:service sendmail restart
CentOS下邮件服务sendmail的安装及简单配置
sendmail是Linux下优秀的邮件系统。在不做任何设定的情况下,sendmail发出邮件的邮箱源地址形如userid@localhost.localdo,这种地址几乎会被所有的邮箱认定为SPAM(垃圾邮件)或直接拒收。
1、 Sendmail安装
在CentOS下,sendmail一般默认是随操作系统一起安装的。如果安装系统时没有安装sendmail服务,手动安装sendmail也很简单:
复制代码代码如下:
# yum install-y sendmail
# yum install-y sendmail-cf
2、 Senmail的SMTP认证配置(不需要认证的可忽略此步)
首先确认saslauthd服务是否安装或启动。
安装saslauthd服务:
复制代码代码如下:# yum install-y saslauthd
启动saslauthd服务:
复制代码代码如下:# service saslauthd start
(1)配置Senmail的SMTP认证
复制代码代码如下:
# vi/etc/mail/sendmail.mc
复制代码代码如下:
dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
将上面两行的dnl去掉。在sendmail文件中,dnl表示该行为注释行,是无效的,因此通过去除行首的dnl字符串可以开启相应的设置行。
(2)设置Sendmail服务的网络访问权限
复制代码代码如下:
# vi/etc/mail/sendmail.mc
复制代码代码如下:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
将127.0.0.1改为0.0.0.0,意思是任何主机都可以访问Sendmail服务。如果仅让某一个网段能够访问到Sendmail服务,将127.0.0.1改为形如192.168.1.0/24的一个特定网段地址。
3、生成Sendmail配置文件
Sendmail的配置文件由m4来生成,m4工具在sendmail-cf包中。如果系统无法识别m4命令,说明sendmail-cf软件包没有安装。
生成Sendmail的配置文件:
复制代码代码如下:
m4/etc/mail/sendmail.mc>/etc/mail/sendmail.cf
需要重启Sendmail才能使配置文件生效。
4、postfix与sendmail的冲突问题
在Linux服务器(CentOS release 6.6)上配置好了sendmail后,测试发送邮件时发现有问题,检查sendmail服务的状态,发现其处于“sendmail dead but subsys locked”,检查发现postfix服务也在运行。只需要将postfix服务停掉即可。为什么会出现这种情况呢?Something was occasionally causing the postfix service to start which then caused the status of sendmail to jump to dead but subsys locked.两种似乎不兼容。
操作步骤:
(1):检查sendmail服务的状态
复制代码代码如下:
[root@DB-Server~]# service sendmail statussendmail dead but subsys lockedsm-client(pid 22112) is running...
(2):检查postfix服务的状态
复制代码代码如下:
[root@DB-Server~]# service postfix statusmaster(pid 1777) is running...
(3):停止postfix服务
复制代码代码如下:
[root@DB-Server~]# service postfix stopShutting down postfix: [ OK ]
(4):重新启动sendmail服务
复制代码代码如下:
[root@DB-Server~]# service sendmail stopShutting down sm-client: [ OK ]Shutting down sendmail: [FAILED][root@DB-Server~]# service sendmail stop[root@DB-Server~]# service sendmail startStarting sendmail: [ OK ]Starting sm-client: [ OK ]
(5):禁用postfix在reboot后自动启动
检查一下是否有设定 postfix在 reboot后自动启动
复制代码代码如下:
chkconfig--list| grep postfix
chkconfig postfix off
linux中mail函数不能发送邮件怎么办
可以参考如下解决办法:
1.重新安装 sendmail组件,我用的是 CentOS,使用下面的命令安装
yum install sendmail
2.使用下面的命令重启php-fpm进程
/etc/init.d/php-fpm restart
3.检测sendmail是否运行正常
/etc/init.d/sendmail status
如果显示正在运行running就可以。
可能用到的命令
/etc/init.d/sendmail start(启动sendmail)
/etc/init.d/sendmail stop(关闭sendmail)
/etc/init.d/sendmail restart(重启sendmail)
4.配置php.ini,填写sendmail的绝对路径
使用命令打开编辑php.ini
vi/usr/local/php/etc/php.ini
输入?sendmail_path查找定位(或者手动跳转找到sendmail_path),你会发现默认是下面的代码
;sendmail_path=
按 i进入编辑,将这行修改为
sendmail_path=/usr/sbin/sendmail-t-i
按 Esc键退出编辑,输入:wq保存退出
5.重启php-fpm进程
/etc/init.d/php-fpm restart