postfix和dovecot 配置 邮件服务器的命令
时间: 2023-11-15 20:04:08 浏览: 162
下面是安装和配置postfix和dovecot的命令:
1. 安装postfix:
```
sudo apt-get update
sudo apt-get install postfix
```
2. 配置postfix:
```
sudo nano /etc/postfix/main.cf
```
在文件中添加以下内容:
```
myhostname = example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, $mydomain
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
home_mailbox = Maildir/
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtp_tls_note_starttls_offer = yes
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
```
保存并退出文件,然后重新启动postfix:
```
sudo service postfix restart
```
3. 安装dovecot:
```
sudo apt-get install dovecot-core dovecot-imapd dovecot-pop3d
```
4. 配置dovecot:
```
sudo nano /etc/dovecot/conf.d/10-auth.conf
```
找到以下行:
```
#disable_plaintext_auth = yes
```
取消注释并将其更改为以下内容:
```
disable_plaintext_auth = no
```
保存并退出文件。
然后打开以下文件:
```
sudo nano /etc/dovecot/conf.d/10-mail.conf
```
找到以下行:
```
mail_location = mbox:~/mail:INBOX=/var/mail/%u
```
将其更改为以下内容:
```
mail_location = maildir:~/Maildir
```
保存并退出文件。
最后启动dovecot:
```
sudo service dovecot restart
```
现在你已经成功安装和配置了postfix和dovecot,你可以使用邮件客户端测试它是否正常工作。
阅读全文