欢迎各位兄弟 发布技术文章
这里的技术是共享的
< SMTP服务器的构建 ( Postfix ) > (最近更新日:2006/09/28)
|
|
| host -t mx centospub.com |
|
| yum -y install postfix ← 在线安装Postfix |
|
| vi /etc/postfix/main.cf← 编辑Postfix的配置文件 #myhostname = host.domain.tld← 找到此行,将等号后面的部分改写为主机名 ↓ myhostname = sample.centospub.com← 变为此状态,设置系统的主机名 #mydomain = domain.tld← 找到此行,将等号后面的部分改写为域名 ↓ mydomain = centospub.com← 变为此状态,设置域名(我们将让此处设置将成为E-mail地址“@”后面的部分) #myorigin = $mydomain← 找到此行,将行首的#去掉 ↓ myorigin = $mydomain← 变为此状态,将发信地址“@”后面的部分设置为域名(非系统主机名) inet_interfaces = localhost← 找到此行,将“localhost”改为“all” ↓ inet_interfaces = all← 变为此状态,接受来自所有网络的请求 mydestination = $myhostname, localhost.$mydomain, localhost← 找到此行,在行为添加“$mydomain” ↓ mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain← 变为此状态,指定发给本地邮件的域名 #relay_domains = $mydestination← 找到此行,将行首的#去掉 ↓ relay_domains = $mydestination← 变为此状态,定义允许转发的域名 #mynetworks = 168.100.189.0/28, 127.0.0.0/8← 找到此行,依照自己的内网情况修改 ↓ mynetworks = 168.100.189.0/28, 127.0.0.0/8← 变为此状态,指定内网和本地的IP地址范围 #home_mailbox = Maildir/← 找到这一行,去掉行首的# ↓ home_mailbox = Maildir/← 变为此状态,指定用户邮箱目录 ← 找到这一行,接此行添加如下行: smtpd_banner = $myhostname ESMTP unknow← 添加这一行,不显示SMTP服务器的相关信息 在配置文件的文尾,添加如下行: smtpd_sasl_auth_enable = yes← 服务器使用SMTP认证 smtpd_sasl_local_domain = $myhostname← 指定SMTP认证的本地域名(主机名) smtpd_sasl_security_options = noanonymous ← 不允许匿名的方式认证 smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination message_size_limit = 15728640← 规定邮件最大尺寸为15MB |
| vi /usr/lib/sasl2/smtpd.conf← 编辑SMTP认证的配置文件 pwcheck_method: saslauthd← 找到此行,将“saslauthd”改为“auxprop” ↓ pwcheck_method: auxprop← 不使用系统用户密码作为用户的SMTP认证密码 vi /etc/sysconfig/saslauthd MECH=shadow #MECH=shadow FLAGS= ↓ FLAGS=sasldb ← 定义认证方式为sasldb2 |
| mkdir /etc/skel/Maildir← 在用户模板下建立用户邮箱目录 chmod 700 /etc/skel/Maildir← 设置用户邮箱目录属性为700 |
| alternatives --config mta ← 设置默认MTA2 ← 在这里输入2,使Postfix成为默认MTA |
|