日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

postfix+dovecot配置多域名邮件服务器

發布時間:2023/12/13 综合教程 37 生活家
生活随笔 收集整理的這篇文章主要介紹了 postfix+dovecot配置多域名邮件服务器 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

mail郵局系統的MX(郵件交換)記錄配置,以便收發郵件。(MX記錄,是郵件交換記錄,它指向一個郵件服務器,用于電子郵件系統發郵件時根據收信人的地址后綴來定位郵件服務器,如果沒有做域名解析,郵局不能正常使用,即不能正常的發送或者接收郵件。)

一、安裝postfixdovecot

yum install postfix dovecot
chkconfig postfix on
chkconfig dovecot on

也可以用一次安裝所有依賴包yum install sysstatpostfixcrontabs redhat-lsb-graphicsredhat-lsb-corearpwatchcronie dovecot

1、配置postfix

vi /etc/postfix/main.cf

# change or add on these line:

myhostname = yes81.net

mydomain = yes81.net

myorigin = $mydomain

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

mynetworks = 127.0.0.0/8

home_mailbox = Maildir/

smtpd_sasl_type = dovecot

smtpd_sasl_path = private/auth

smtpd_sasl_auth_enable = yes

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, permit

broken_sasl_auth_clients = yes

2dovecot配置

vi /etc/dovecot/dovecot.conf

# uncomment on this line:

protocols = imap pop3

listen = *

3、配置認證方式

vi /etc/dovecot/conf.d/10-auth.conf

# change on these line:

disable_plaintext_auth = no

auth_mechanisms = plain login

4、設置郵箱文件夾

vi /etc/dovecot/conf.d/10-mail.conf

mail_location = maildir:~/Maildir

5、配置認證

vi /etc/dovecot/conf.d/10-master.conf

# commented on these line:

#unix_listener auth-userdb {

#mode = 0600

#user =

#group =

#}

# change or setup on these line:

# Postfix smtp-auth

unix_listener /var/spool/postfix/private/auth {

mode = 0666

user = postfix

group = postfix

}

6、配置pop3

vi /etc/dovecot/conf.d/20-pop3.conf

# uncomment on these line:

pop3_uidl_format = %08Xu%08Xv

pop3_client_workarounds = outlook-no-nuls oe-ns-eoh

7、重啟dovecotpostfix

Service dovecot restart

Service postfix restart

8、增加用戶和設置用戶密碼

這個時候就可以增加用戶和設置用戶密碼,然后測試收發

groupadd mailuser

adduser -g mailuser -s /sbin/nologin test1

passwdtest1

adduser -g mailuser -s /sbin/nologin test2

passwdtest2

打開FOXMAIL等郵件工具測試,能正常收發,就表示系統可以了。

test1@mail.yes81.nettest2@mail.yes81.net

二、如果無法發信

試著發送郵件,如果發送不出去,查看日志文件/var/log/maillog如果顯示:

postfix/smtp[17105]: fatal: unknown service: smtp/tcp

postfix/smtpd: disconnect from unknown[113.64.242.145]

postfix/qmgr: warning: private/smtp socket: malformed response

postfix/qmgr: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description

postfix/master: warning: process /usr/libexec/postfix/smtp pid 17105 exit status 1

postfix/master: warning: /usr/libexec/postfix/smtp: bad command startup -- throttling

這是由于郵件默認的postfix賬號無法執行/etc/services,權限不足所致。查看service的權限為640:

Chmod 644 /etc/services于是將其改為644:

重新啟動2個服務后就可以看到,一切正常了!

三、如何添加虛擬域名:

http://www.postfix.org/VIRTUAL_README.html

按照官方指導,對于多域名的支持postfix支持以下幾種方式:

1.共享域名,共享Unix賬戶

2.虛擬別名(Virtual Alias)獨立域名,共享Unix賬戶

3.虛擬郵箱(Virtual Mailbox)獨立域名,無需Unix賬戶

4.轉發服務器(Forwarding Server)用做備份服務器,主服務器故障時暫存郵件,恢復后直接轉發給主服務器

從官網查到后,決定采用第2種方法:虛擬別名(Virtual Alias)獨立域名,共享Unix賬戶

vi /etc/postfix/main.cf 
 virtual_alias_domains = t3t3.org
virtual_alias_maps = hash:/etc/postfix/virtual
alias_maps=hash:/etc/aliases
vi /etc/postfix/virtual
 test1@t3t3.org test1
test2@t3t3.org test2
test1@yes81.net test1
test2@yes81.net test2
vi /etc/aliases //把剛添加的帳號做個別名
test1: test1
test2: test2

postmap /etc/postfix/virtual//reload數據庫后需新域名就可以使用了

postalias /etc/aliases//postfix/etc/aliases命令是否等同?

newaliases

postfixreload//reload

Service dovecot restart//重新啟動

Service postfix restart//重新啟動

如果操作postfix/etc/aliases時候出現/usr/libexec/postfix/postfix-script: line 337: /etc/aliases: Permission denied則需要修改權限:

chmod 664 /etc/aliases

chown root /etc/aliases

chmod 755 /etc/aliases.db

chown smmsp /etc/aliases.db

修改好權限后,再次執行reload和重新等命令

如此后郵件服務器就可以用test1@yes81.nettest1@t3t3.org進行收發郵件了。

總結

以上是生活随笔為你收集整理的postfix+dovecot配置多域名邮件服务器的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。