本文主要是介绍sendmail.mc配置文件的解释,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
原文:http://www.linuxsir.org/bbs/showthread.php?t=179390我在书(Redhat Linux 9 宝典)上看到一篇sendmail.mc的注释文档,觉得挺好的就摘录了下来,与大家分享。希望对大家有帮助。当然不对的和不足的地方,请大家改正。
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
将sendmail所需的规则包含进来。
VERSIONID(`setup for Red Hat Linux')dnl
指出配置文件是针对Red Hat Linux,(可以任意值)
OSTYPE(`linux')dnl
必须设置为linux以获得sendmail所需文件的正确位置。
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
指定以mail用户(UID:8)和mail组(GID:12)的身份运行守护进程。
Define(`confTRUSTED_USER`,`SMMSP`) dnl
将smmsp添加到sendmail的可信用户列表中,其他的可信用户是root,uucp,daemon(smmsp用户被赋予部分sendmail假脱机目录和邮件数据库文件的所有权。
dnl define(`confAUTO_REBUILD')dnl
如果有必要,sendmail将自动重建别名数据库。
define(`confTO_CONNECT', `1m')dnl
将sendmail等待初始连接完成的时间设置为1分钟(1m)
define(`confTRY_NULL_MX_LIST',true)dnl
设为true,如果接收服务器是一台主机最佳的MX,试着直接连接那台主机。
define(`confDONT_PROBE_INTERFACES',true)dnl
设为true,sendmai守护进程将不会把本地网络接口插入到已知等效地址列表中。
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
设置分发接收邮件的程序(默认是procmail)。
define(`ALIAS_FILE', `/etc/aliases')dnl
设置分发接收邮件的邮件别名数据库。
dnl define(`STATUS_FILE', `/etc/mail/statistics')dnl
设置分发接收邮件的邮件统计文件的位置。
define(`UUCP_MAILER_MAX', `2000000')dnl
设置UUCP邮件程序接收的最大信息(以字节计)
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
设置用户数据库(在该数据库中可替换特定用户的默认邮件服务器)的位置。
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
强制sendmail使用某种邮件协议,例如,authwarnings表明使用X- Authentication-Warning 标题,并记录在日志文件中;novrfy和noexpn设置防止请求相应的服务,restrictqrun选项禁止sendmail使用-q选项。
define(`confAUTH_OPTIONS', `A')dnl
设置由于SMTP验证。
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 #
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
允许sendmail使用明文口令以外的其他验证机制。
dnl #
dnl # Rudimentary information on creating certificates for sendmail TLS:
dnl # make -C /usr/share/ssl/certs usage
dnl #
dnl define(`confCACERT_PATH',`/usr/share/ssl/certs')
dnl define(`confCACERT',`/usr/share/ssl/certs/ca-bundle.crt')
dnl define(`confSERVER_CERT',`/usr/share/ssl/certs/sendmail.pem')
dnl define(`confSERVER_KEY',`/usr/share/ssl/certs/sendmail.pem')
以上四行启用证书。
dnl #
dnl # This allows sendmail to use a keyfile that is shared with OpenLDAP's
dnl # slapd, which requires the file to be readble by group ldap
dnl #
dnl define(`confDONT_BLAME_SENDMAIL',`groupreadablekeyfile')dnl
如果密钥文件需要被除sendmail外的其他应用程序读取,那么显示以上行。
dnl #
dnl define(`confTO_QUEUEWARN', `4h')dnl
设置邮件发送被延期多久之后向发送人发送通知消息,默认为4小时。
dnl define(`confTO_QUEUERETURN', `5d')dnl
设置多长时间返回一个无法发送消息。
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
以上二行分别设置排队或拒绝的接收邮件的系统负载平均水平。
define(`confTO_IDENT', `0')dnl
设置等待接收IDENT查询响应的超时值(默认为0,永不超时)
FEATURE宏用于设置一些特殊的sendmail特性。
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa',`dnl')dnl
FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
Smrsh定义/usr/sbin/smrsh 作为sendmail用来接受命令的简单shell。
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
设置mailertable数据库位置
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
设置`virtusertable数据库位置
FEATURE(redirect)dnl
允许拒绝接收已移走的用户的邮件并提供其新地址。
FEATURE(always_add_domain)dnl
always_add_domain使得在所有发送的邮件上为主机名添加本地域名。
FEATURE(use_cw_file)dnl
表明sendmail使用/etc/mail/local-host-names文件为该邮件服务器提供另外得主机名
FEATURE(use_ct_file)dnl
表明sendmail使用/etc/mail/trusted-users文件提供可信用户名(可信用户可用另一个用户名发送邮件而不会收到警告消息)。
dnl #
dnl # The -t option will retry delivery if e.g. the user runs over his quota.
dnl #
FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl
设置用于递送本地邮件得命令(procmail)及其选项($h:hostname,$u:user name).
FEATURE(`access_db',`hash -T<TMPF> -o /etc/mail/access.db')dnl
设置访问数据库得位置,该数据库指出允许哪些主机通过此服务器中继邮件。
FEATURE(`blacklist_recipients')dnl
启用该服务器为所选用户、主机或地址阻塞接收邮件的功能。(access_db和blacklist_recipients特性对防止垃圾邮件有用)。
EXPOSED_USER(`root')dnl
dnl #
dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
允许接受本地主机创建的邮件,如果要允许接收从Internet或其他网络接口(如局域网)传入的邮件,一定要注释掉此行。
dnl #
dnl # The following causes sendmail to additionally listen to port 587 for
dnl # mail from MUAs that authenticate. Roaming users who can't reach their
dnl # preferred sendmail daemon due to port 25 being blocked or redirected find
dnl # this useful.
dnl #
dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 465, but
dnl # starting immediately in TLS mode upon connecting. Port 25 or 587 followed
dnl # by STARTTLS is preferred, but roaming clients using Outlook Express can't
dnl # do STARTTLS on ports other than 25. Mozilla Mail can ONLY use STARTTLS
dnl # and doesn't support the deprecated smtps; Evolution <1.1.1 uses smtps
dnl # when SSL is enabled-- STARTTLS support is available in version 1.1.1.
dnl #
dnl # For this to work your OpenSSL certificates must be configured.
dnl #
dnl DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl
dnl #
dnl # The following causes sendmail to additionally listen on the IPv6 loopback
dnl # device. Remove the loopback address restriction listen to the network.
dnl #
dnl # NOTE: binding both IPv4 and IPv6 daemon to the same port requires
dnl # a kernel patch
dnl #
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')dnl
dnl #
dnl # We strongly recommend not accepting unresolvable domains if you want to
dnl # protect yourself from spam. However, the laptop and users on computers
dnl # that do not have 24x7 DNS do need this.
dnl #
FEATURE(`accept_unresolvable_domains')dnl
启用accept_unresolvable_domains,使得能够接收域名不可解析的主机发送来的邮件。如果有需要使用邮件服务器的客户机(如拨号计算机),启用该选项。关闭该选项有助于防止垃圾邮件。
dnl #
dnl FEATURE(`relay_based_on_MX')dnl
dnl #
dnl # Also accept email sent to "localhost.localdomain" as local email.
dnl #
LOCAL_DOMAIN(`localhost.localdomain')dnl
使域名`localhost.localdomain作为本地计算机名被接受。
dnl #
dnl # The following example makes mail from this host and any additional
dnl # specified domains appear to be sent from mydomain.com
dnl #
dnl MASQUERADE_AS(`mydomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
dnl FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
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
将sendmail所需的规则包含进来。
VERSIONID(`setup for Red Hat Linux')dnl
指出配置文件是针对Red Hat Linux,(可以任意值)
OSTYPE(`linux')dnl
必须设置为linux以获得sendmail所需文件的正确位置。
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
指定以mail用户(UID:8)和mail组(GID:12)的身份运行守护进程。
Define(`confTRUSTED_USER`,`SMMSP`) dnl
将smmsp添加到sendmail的可信用户列表中,其他的可信用户是root,uucp,daemon(smmsp用户被赋予部分sendmail假脱机目录和邮件数据库文件的所有权。
dnl define(`confAUTO_REBUILD')dnl
如果有必要,sendmail将自动重建别名数据库。
define(`confTO_CONNECT', `1m')dnl
将sendmail等待初始连接完成的时间设置为1分钟(1m)
define(`confTRY_NULL_MX_LIST',true)dnl
设为true,如果接收服务器是一台主机最佳的MX,试着直接连接那台主机。
define(`confDONT_PROBE_INTERFACES',true)dnl
设为true,sendmai守护进程将不会把本地网络接口插入到已知等效地址列表中。
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
设置分发接收邮件的程序(默认是procmail)。
define(`ALIAS_FILE', `/etc/aliases')dnl
设置分发接收邮件的邮件别名数据库。
dnl define(`STATUS_FILE', `/etc/mail/statistics')dnl
设置分发接收邮件的邮件统计文件的位置。
define(`UUCP_MAILER_MAX', `2000000')dnl
设置UUCP邮件程序接收的最大信息(以字节计)
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
设置用户数据库(在该数据库中可替换特定用户的默认邮件服务器)的位置。
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
强制sendmail使用某种邮件协议,例如,authwarnings表明使用X- Authentication-Warning 标题,并记录在日志文件中;novrfy和noexpn设置防止请求相应的服务,restrictqrun选项禁止sendmail使用-q选项。
define(`confAUTH_OPTIONS', `A')dnl
设置由于SMTP验证。
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 #
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
允许sendmail使用明文口令以外的其他验证机制。
dnl #
dnl # Rudimentary information on creating certificates for sendmail TLS:
dnl # make -C /usr/share/ssl/certs usage
dnl #
dnl define(`confCACERT_PATH',`/usr/share/ssl/certs')
dnl define(`confCACERT',`/usr/share/ssl/certs/ca-bundle.crt')
dnl define(`confSERVER_CERT',`/usr/share/ssl/certs/sendmail.pem')
dnl define(`confSERVER_KEY',`/usr/share/ssl/certs/sendmail.pem')
以上四行启用证书。
dnl #
dnl # This allows sendmail to use a keyfile that is shared with OpenLDAP's
dnl # slapd, which requires the file to be readble by group ldap
dnl #
dnl define(`confDONT_BLAME_SENDMAIL',`groupreadablekeyfile')dnl
如果密钥文件需要被除sendmail外的其他应用程序读取,那么显示以上行。
dnl #
dnl define(`confTO_QUEUEWARN', `4h')dnl
设置邮件发送被延期多久之后向发送人发送通知消息,默认为4小时。
dnl define(`confTO_QUEUERETURN', `5d')dnl
设置多长时间返回一个无法发送消息。
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
以上二行分别设置排队或拒绝的接收邮件的系统负载平均水平。
define(`confTO_IDENT', `0')dnl
设置等待接收IDENT查询响应的超时值(默认为0,永不超时)
FEATURE宏用于设置一些特殊的sendmail特性。
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa',`dnl')dnl
FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
Smrsh定义/usr/sbin/smrsh 作为sendmail用来接受命令的简单shell。
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
设置mailertable数据库位置
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
设置`virtusertable数据库位置
FEATURE(redirect)dnl
允许拒绝接收已移走的用户的邮件并提供其新地址。
FEATURE(always_add_domain)dnl
always_add_domain使得在所有发送的邮件上为主机名添加本地域名。
FEATURE(use_cw_file)dnl
表明sendmail使用/etc/mail/local-host-names文件为该邮件服务器提供另外得主机名
FEATURE(use_ct_file)dnl
表明sendmail使用/etc/mail/trusted-users文件提供可信用户名(可信用户可用另一个用户名发送邮件而不会收到警告消息)。
dnl #
dnl # The -t option will retry delivery if e.g. the user runs over his quota.
dnl #
FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl
设置用于递送本地邮件得命令(procmail)及其选项($h:hostname,$u:user name).
FEATURE(`access_db',`hash -T<TMPF> -o /etc/mail/access.db')dnl
设置访问数据库得位置,该数据库指出允许哪些主机通过此服务器中继邮件。
FEATURE(`blacklist_recipients')dnl
启用该服务器为所选用户、主机或地址阻塞接收邮件的功能。(access_db和blacklist_recipients特性对防止垃圾邮件有用)。
EXPOSED_USER(`root')dnl
dnl #
dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
允许接受本地主机创建的邮件,如果要允许接收从Internet或其他网络接口(如局域网)传入的邮件,一定要注释掉此行。
dnl #
dnl # The following causes sendmail to additionally listen to port 587 for
dnl # mail from MUAs that authenticate. Roaming users who can't reach their
dnl # preferred sendmail daemon due to port 25 being blocked or redirected find
dnl # this useful.
dnl #
dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 465, but
dnl # starting immediately in TLS mode upon connecting. Port 25 or 587 followed
dnl # by STARTTLS is preferred, but roaming clients using Outlook Express can't
dnl # do STARTTLS on ports other than 25. Mozilla Mail can ONLY use STARTTLS
dnl # and doesn't support the deprecated smtps; Evolution <1.1.1 uses smtps
dnl # when SSL is enabled-- STARTTLS support is available in version 1.1.1.
dnl #
dnl # For this to work your OpenSSL certificates must be configured.
dnl #
dnl DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl
dnl #
dnl # The following causes sendmail to additionally listen on the IPv6 loopback
dnl # device. Remove the loopback address restriction listen to the network.
dnl #
dnl # NOTE: binding both IPv4 and IPv6 daemon to the same port requires
dnl # a kernel patch
dnl #
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')dnl
dnl #
dnl # We strongly recommend not accepting unresolvable domains if you want to
dnl # protect yourself from spam. However, the laptop and users on computers
dnl # that do not have 24x7 DNS do need this.
dnl #
FEATURE(`accept_unresolvable_domains')dnl
启用accept_unresolvable_domains,使得能够接收域名不可解析的主机发送来的邮件。如果有需要使用邮件服务器的客户机(如拨号计算机),启用该选项。关闭该选项有助于防止垃圾邮件。
dnl #
dnl FEATURE(`relay_based_on_MX')dnl
dnl #
dnl # Also accept email sent to "localhost.localdomain" as local email.
dnl #
LOCAL_DOMAIN(`localhost.localdomain')dnl
使域名`localhost.localdomain作为本地计算机名被接受。
dnl #
dnl # The following example makes mail from this host and any additional
dnl # specified domains appear to be sent from mydomain.com
dnl #
dnl MASQUERADE_AS(`mydomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
dnl FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
这篇关于sendmail.mc配置文件的解释的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!