postfix邮件服务器
★ Modify the MTA (default message transfer agent) command ____ to send mail:
Alternatives--config MTA
★ Check that the MTA is set up successfully:
Alternatives--display MTA
Build the environment: centos6.9;
[Email protected] ~]# hostname
mail.xpt.cn
[Email protected] ~]# hostname-i
192.168.199.143
[Email protected] ~]# cat/etc/hosts
192.168.199.143 mail.xpt.cn
192.168.199.143 xpt.cn
[Email protected] ~]# cat/etc/resolv.conf
Search Localdomain xpt.cn
NameServer 192.168.199.2
Installation configuration postfix:
Yum install Postfix
Important parameters in the main configuration file of the Postfix service program: |-------------------------------------------------| | Myhostname | Host name of the Post Office system | |-------------------------------------------------| | MyDomain | The domain name of the Post Office system | |-------------------------------------------------| | Myorigin | Name of the domain that sent the message from this computer | |-------------------------------------------------| | inet_interfaces | Nic Interface for listening | |-------------------------------------------------| | mydestination | Host name or domain name of the message that can be received | |-------------------------------------------------| | Mynetworks | Set up mail for which hosts can be forwarded | |-------------------------------------------------| | Relay_domains | Set up mail for which domains can be forwarded | |-------------------------------------------------|vim/etc/postfix/main.cf: #在第 76 rows Define a variable named Myhostname, The host name used to save the server; Myhostname = mail.linuxprobe.com #在第 83 rows defines a variable named MyDomain that holds the name of the mail domain mydomain = linuxprobe.com #在第 99 lines Call the previous mydomainVariable that defines the domain in which the message is sent. Myorigin = $mydomain #在第 116 lines define the network card listening address. #可以指定要使用服务器的哪些 IP Address to provide e-mail service; #也可以干脆写成 all to provide e-mail services on behalf of all IP addresses: inet_interfaces = All #在第 164 rows define the available Host name or domain Name list of the received message 164 Mydestination = $myhostname, $mydomain
To create a login account for your e-mail system:
[Email protected] ~]# Useradd boss
[Email protected] ~]# echo "123456" | passwd--stdin Boss
[[Email protected] ~] #service postfix start
Installation configuration Dovecot:
Yum Install Dovecot
vim /etc/dovecot/dovecot.conf : #第 24 行,把 Dovecot 服务程序支持的电子邮件协议修改为 imap、pop3 和 lmtp 24 protocols = imap pop3 lmtp #允许用户使用明文进行密码验证 25 disable_plaintext_auth = no #第 48 行,设置允许登录的网段地址, #也就是说我们可以在这里限制只有来自于某个网段的用户才能使用电子邮件系统。 #如果想允许所有人都能使用,则不用修改本参数 48 login_trusted_networks = 192.168.10.0/24vim /etc/dovecot/conf.d/10-mail.conf : #第 24 行前面的井号(#)删除 24 mail_location = mbox:~/mail:INBOX=/var/mail/%u[[email protected] ~]# su - boss[[email protected] ~]$ mkdir -p mail/.imap/INBOX[[email protected] ~]$ exit[[email protected] ~]serice dovecot start
Test with Foxmail or install MAILX on the server to send mail
Install the Mail command:
Yum Install Mailx
Linux build postfix mail service