Postfix SMTP邮件服务器的配置与使用方法
思韵闪耀
2013-03-19
0

最近要帮朋友配置一个SMTP服务器,需求就是每天需要向外发送上百万封邮件,google之,发现postfix邮件服务器比较靠谱, 能够发送外部邮件,于是就选它了

操作系统:CentOS 5 32bit

postfix安装

可以通过源码安装最新的版本,但是为了方便,我直接使用yum安装

sudo yum install postfix

配置文件路径:/etc/postfix/main.cf

postfix启动与停止命令:

sudo /etc/init.d/postfix start
sudo /etc/init.d/postfix stop
sudo /etc/init.d/postfix restart

postfix日志文件位置:/var/log/maillog

卸载sendmail
检查系统是否安装sendmail:

如果存在,卸载之

安装cyrus-sasl-2.1.23

由于在centos 源中不存在,直接通过源码安装cyrus-sasl-2.1.23.tar.gz
下载地址
./configure &&make &&make install

这个软件包的作用就是postfix邮件服务器的认证,因为如果转发外部的邮件,必须使用smtpd_recipient_restrictions选项的值check_relay_domains或者是reject_unauth_destination,二者必须选一个,而relay_damains手工来配置允许的邮件域太麻烦,所以就选用sasl认证

修改sasl配置:/etc/sysconfig/saslauthd为

# Directory in which to place saslauthd's listening socket, pid file, and so
# on.  This directory must already exist.
START=yes
SOCKETDIR=/var/run/saslauthd
# Mechanism to use when checking passwords.  Run "saslauthd -v" to get a list
# of which mechanism your installation was compiled with the ablity to use.
#MECH="pam"
MECHANISMS="pam" #使用linux自身的用户认证
# Additional flags to pass to saslauthd on the command line.  See saslauthd(8)
# for the list of accepted flags.
#FLAGS=

然后重启saslauthd:

sudo /etc/init.d/saslauthd restart

测试saslauthd生效:

/usr/sbin/testsaslauthd -u liyg -p liyangguang
将sasl与postfix结合

在main.cf文件中加入:

#added by liyangguang
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
#smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous

重启postfix :sudo /etc/init.d/postfix restart。
然后通过foxmail客户端配置smtp服务器地址,测试发送邮件是否成功


【版权声明】
本站部分内容来源于互联网,本站不拥有所有权,不承担相关法律责任。如果发现本站有侵权的内容,欢迎发送邮件至masing@13sy.com 举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。

相关内容

开源邮件服务器对比,看看哪...
开源邮件服务器对比,看看哪款适合你开源的企业邮件系统通常提供完整的...
2025-07-24
要在 Alibaba Cl...
要在 Alibaba Cloud Linux 上安装 Docker...
2025-07-22
要在 Alibaba Cl...
要在 Alibaba Cloud Linux 系统中添加 alin...
2025-07-22
将IIS设置克隆到新服务器...
将IIS设置克隆到新服务器的最佳方法是使用IIS配置文件。以下是详...
2025-06-06
搭建Git服务器及本机克隆...
Git是什么?Git是目前世界上最先进的分布式版本控制系统。SVN...
2025-03-17
ubuntu环境下搭建gi...
操作环境:服务器:Ubuntu 24.04.2 LTS+git 2...
2025-03-17

热门资讯

Roundcube 配置过各提... Fileinfo/mime_content_type configuration: OK Mimet...
搭建PostfixAdmin ... 一、原理及其应用: 笔者之前就职在上海一家信息公司,至力于全面的电子邮件营销解决方案,公司中等规模,...
在wdos系统下搭建postf... 一.简介: 1. wdOS是一个基于CentOS版本精简优化过的Linux服务器系统,大部分保留着c...
RHEL5系统中安装Postf... 前提1:安装RHEL5时把所有的开发工具装上。 原理图 前提2 :开始前请确保您已经配置好指向此邮件...
Linux停止和启动postf... 1.启动Postfix服务 启动Postfix服务的命令为: /etc/init.d/postfix...