如何使用sendmail配置企业简易邮件系统
如何使用sendmail配置企业简易邮件系统
企业邮件系统通常由三部分组成:邮件服务器、邮件客户端和邮件存储。邮件服务器负责接收和发送邮件,邮件客户端负责收发邮件,邮件存储负责存储邮件。
邮件服务器一般分为两类:POP3服务器和IMAP服务器。POP3服务器主要负责接收邮件,用户使用邮件客户端从POP3服务器下载邮件。IMAP服务器主要负责存储邮件,用户使用邮件客户端通过IMAP协议从IMAP服务器收发邮件。
sendmail是一个用于Unix/Linux平台的开源邮件服务器软件,可以作为POP3服务器或IMAP服务器使用。
下面介绍如何使用sendmail配置企业简易邮件系统。
首先,安装sendmail软件包,可以从官网下载安装包进行安装,也可以使用yum命令安装:
yum install sendmail
安装完成后,配置sendmail服务器。
打开/etc/mail/sendmail.mc文件,在dnl # Include the MC file generated by m4 above.dnl下面一行加入include(`/etc/mail/tls.mc')dnl,然后保存文件。
接下来,编辑/etc/mail/tls.mc文件,在dnl #### TLS Settingsdnl下面添加如下内容:
dnl #### TLS Settingsdnl
dnl # Use TLSv1dnl
define(`confUSE_TLS', `True')dnl
dnl # You need a certificate in /etc/pki/tls/certs and the matching key in
dnl # /etc/pki/tls/key. Make sure to generate it with:
dnl # make certreq && make sendmail-cert
dnl # Define these to use certificate in /etc/pki/tls/certs and key in
dnl # /etc/pki/tls/keydnl
define(`confSERVER_CERT', `/etc/pki/tls/certs/sendmail.pem')dnl
define(`confSERVER_KEY', `/etc/pki/tls/key/sendmail.pem')dnl
dnl # Trusted certificates. For CAs, place certificates in /etc/pki/tls/certs
dnl # and CRL in /etc/pki/tls/crldnl
define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl
define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')dnl
define(`confSERVER_CERT_FINGERPRINTS', `/etc/mail/certs.md5')dnl
dnl # Client certificates. Place certificates in
dnl # /etc/pki/tls/certs and keys in /etc/pki/tls/keydnl
define(`confCLIENT_CERT', `/etc/pki/tls/certs/client-cert.pem')dnl
define(`confCLIENT_KEY', `/etc/pki/tls/key/client-key.pem')dnl
dnl # This defines who we trust and what CRLs we should check.dnl
define(`confTLS_SRV_OPTIONS', `V')dnl
dnl # This allows relaying if the user authenticates with POP or IMAP.dnl
define(`confTLS_PERM_CERT_FILE', `/etc/pki/tls/certs/ca-bundle.crt')dnl
define(`confTLS_PERM_CRL_FILE', `/etc/pki/tls/crl.pem')dnl
dnl # This defines who we trust and what CRLs we should check.dnl
define(`confTLS_SRV_OPTIONS', `V')dnl
dnl # This allows relaying if the user authenticates with POP or IMAP.dnl
define(`confTLS_PERM_CERT_FILE', `/etc/pki/tls/certs/ca-bundle.crt')dnl
define(`confTLS_PERM_CRL_FILE', `/etc/pki/tls/crl.pem')dnl
保存文件,然后重新编译sendmail配置文件:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
接下来,启动sendmail服务:
systemctl start sendmail
最后,设置sendmail服务开机自启动:
systemctl enable sendmail
配置完成后,sendmail服务器就可以使用了。
相关文章