www.2527.com_澳门新葡8455手机版_新京葡娱乐场网址_
做最好的网站

详解sendmail服务器的搭建,配置文件

2019-07-26 21:45 来源:未知

  环境:RedHat Linux 9.0 完全安装或者确保以下安装包已经安装完毕:
  imap-2001a-18.i286.rpm
  sendmail-8.12.8-4.i386.rpm
  m4-1.4.1-13.i386.rpm
  cyrus-sasl-2.1.10-4.i386.rpm
  cyrus-sasl-md5-2.1.10-4.i386.rpm
  cyrus-sasl-plain-2.1.10-4.i386.rpm
  cyrus-sasl-gssapi-2.1.10-4.i386.rpm
  目的:实现带认证功能的邮件服务器的配置安装
  
  一. Sendmail服务配置
  1. 安装RedHat Linux 9.0后,修改/etc/mail/sendmail.mc,修改后文件如下:
  divert(-1)dnl
  dnl #
  dnl # This is the sendmail macro config file for m4. If you make changes to
  dnl # /etc/mail/sendmail.mc, you will need to regenerate the
  dnl # /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is
  dnl # installed and then performing a
  dnl #
  dnl # make -C /etc/mail
  dnl #
  include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
  VERSIONID(`setup for Red Hat Linux')dnl
  OSTYPE(`linux')dnl
  dnl #
  dnl # Uncomment and edit the following line if your outgoing mail needs to
  dnl # be sent out through an external mail server:
  dnl #
  dnl define(`SMART_HOST',`smtp.your.provider')
  dnl #
  define(`confDEF_USER_ID',``8:12'')dnl
  define(`confTRUSTED_USER', `smmsp')dnl
  dnl define(`confAUTO_REBUILD')dnl
  define(`confTO_CONNECT', `1m')dnl
  define(`confTRY_NULL_MX_LIST',true)dnl
  define(`confDONT_PROBE_INTERFACES',true)dnl
  define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
  define(`ALIAS_FILE', `/etc/aliases')dnl
  dnl define(`STATUS_FILE', `/etc/mail/statistics')dnl
  define(`UUCP_MAILER_MAX', `2000000')dnl
  define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
  define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
  define(`confAUTH_OPTIONS', `A')dnl
  dnl #
  dnl # The following allows relaying if the user authenticates, and disallows
  dnl # plaintext authentication (PLAIN/LOGIN) on non-TLS links
  dnl #
  dnl define(`confAUTH_OPTIONS', `A p')dnl
  dnl #
  dnl # PLAIN is the preferred plaintext authentication method and used by
  dnl # Mozilla Mail and Evolution, though Outlook Express and other MUAs do
  dnl # use LOGIN. Other mechanisms should be used if the connection is not
  dnl # guaranteed secure.
  dnl # 新京葡娱乐场网址 1

Sendmail 配置文件如下:

本人很喜欢Suse,在工作中也很喜欢总结关于Suse的经验教训,下面就这个问题来详细说说吧。此篇文章的初衷是看大家都说sendmail服务器复杂,为了更简明扼要的成功配置出sendmail服务器,希望能给大家的学习带来帮助。

/etc/mail/sendmail.mc

第一步:安装Sendmail服务器

dnl #

(1)用rpm命令安装Sendmail.在RHLE5中用system-config-packages安装cyrus-sasl,sendmai及sendmail-cf软件包,具体包为cyrus-sasl-2.1.22-4.i386,sendmail-8.13.8-2.e15.i386和sendmai-cf-8.13.8-2.e15.i386;RHEL4中安装sendmail,sendmail-cf及sendmail-doc软件包,推荐用system-config-packages.

dnl # This is the sendmail macro config file for m4. If you make changes to

(2)域名设置:

dnl # /etc/mail/sendmail.mc, you will need to regenerate the

1,在DNS服务器中要添加MX记录
@ IN MX 5       mail.test.com
mail.test.com                     IN   A           192.168.1.102

dnl # /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is

2,设置local-host-names文件 vi /etc/mail/local-host-names    //添加邮件服务器提供服务的域名
test.com

dnl # installed and then performing a

3,开启Sendmail服务器的网络接口 vi /etc/mail/sendmail.mc

dnl #

//查找设置行
DAEMON_OPTIONS('Port=smtp,Addr=127.0.0.1,Name=MTA')dn1 将127.0.0.1改为0.0.0.0
//即使服务器能够为主机的所有网络接口(0.0.0.0)提供服务

dnl # make -C /etc/mail

(3)配置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 #

将这二行的dnl去掉 //在sendmail文件中,dnl表示该行为注释行,是无效的,因此通过去除行首的dnl字符串可以开启相应的设置行.

include(`/usr/share/sendmail-cf/m4/cf.m4')dnl (将sendmail-cf/m4/cf.m4包含进来)

*RHEL4*5中,sendmail.conf配置文件设置使用saslauthd服务程序提供了用户的认证程度,所以必须启动sasaauthd服务。

VERSIONID(`setup for Red Hat Linux')dnl (定义版本信息)

(4)访问控制的配置access,在RHEL4&5中,默认了Sendmail服务器所在的主机的用户可以任意发送邮件,而不需要任何身份验证

OSTYPE(`linux')dnl (选择包含操作系统指定属性的文件)

即注意/etc/mail/access文件中有一行: 127.0.0.1 RELAY   //RELAY是中继,驿马的意思,其实也蛮形象的,我建议用驿马理解这句话的意思.
makemap hash access.db数据库文件

dnl #

(5)使用m4命令生成sendmail.cf文件,其实sendmail.mc即是一模板文件
m4 sendmail.mc >sendmail.cf
启动Sendmail,saslauthd服务,验证Sendmail服务
telnet localhost 25 //输入ehlo localhost 此时应该有LOGIN PLAIN的字样,即表示SMTP认证设置成功.
chkconfig --level 35 saslauthd on
service saslauthd start

dnl # default logging level is 9, you might want to set it higher to

第二步:配置Dovecot服务器

dnl #新京葡娱乐场网址, debug the configuration

用命令system-config-packages安装dovecot软件包,vi /etc/dovecot.conf

dnl #

将#protocols =imap imaps pop3 pop3s 前面的#去掉,RHEL4中加上pop3,pop3s

dnl define(`confLOG_LEVEL', `9')dnl

启动dovecot服务 service dovecot start

dnl #

第三步:启动DNS,saslauthd,sendmail.dovecot服务进行测试

dnl # Uncomment and edit the following line if your outgoing mail needs to

完成以上步骤此时可以一个sendmail邮件系统就搭建成功了,看完本文希望你有所收获,能简单快速的完成sendmail服务器的建立。

dnl # be sent out through an external mail server:

  1. Open Suse Linux平台迁移好与坏
  2. 解决Suse中文编码问题知识
  3. 操作笔记:SUSE FAQ修改XWindows分辨率
  4. Suse下无线网卡DWL与G122驱动模块
  5. 好文分享:EFI Shell引导SuSE

dnl #

...

dnl define(`SMART_HOST',`smtp.your.provider')

dnl #

define(`confDEF_USER_ID',``8:12'')dnl (指定使用的用户ID为8,组ID为12)

dnl define(`confAUTO_REBUILD')dnl

define(`confTO_CONNECT', `1m')dnl (设置等待连接的最大时间为1分钟)

define(`confTRY_NULL_MX_LIST',true)dnl (若MX记录指向本机,则sendmail直接连接到远程主机)

define(`confDONT_PROBE_INTERFACES',true)dnl (sendmial不会自动将服务器的网络接口视为有效地址)

define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl(设置procmail的存放路径)

define(`ALIAS_FILE', `/etc/aliases')dnl (设置邮件别名存放路径)

define(`STATUS_FILE', `/var/log/mail/statistics')dnl

define(`UUCP_MAILER_MAX', `2000000')dnl (设置处理信息的最大限制为2M)

define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl (设置用户数据库文件路径)

define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl (设置限制某些邮件命令的标志)

define(`confAUTH_OPTIONS', `A')dnl 仅在授权成功时。将AUTH参数加到邮件的消息头中

配置文件如下: /etc/mail/sendmail.mc dnl # dnl # This is the sendmail macro config file for m4. If you make changes to dnl # /etc/mail/sendmail.mc, you will need to...

TAG标签:
版权声明:本文由澳门新葡8455手机版发布于新京葡娱乐场网址,转载请注明出处:详解sendmail服务器的搭建,配置文件