173 أسطر
2.1 KiB
Markdown
173 أسطر
2.1 KiB
Markdown
# 📧 Dovecot Local Setup & IMAP Testing
|
||
|
||
## 📌 Overview
|
||
|
||
This project demonstrates the setup and validation of a local Dovecot IMAP server on Ubuntu.
|
||
It includes installation, configuration, authentication, and IMAP testing.
|
||
|
||
---
|
||
|
||
## 🧱 Installation
|
||
|
||
```bash
|
||
sudo apt update
|
||
sudo apt install dovecot-core dovecot-imapd
|
||
```
|
||
|
||
---
|
||
|
||
## ⚙️ Configuration
|
||
|
||
Edit the mail configuration file:
|
||
|
||
```bash
|
||
sudo nano /etc/dovecot/conf.d/10-mail.conf
|
||
```
|
||
|
||
Update:
|
||
|
||
```ini
|
||
mail_location = maildir:~/Maildir
|
||
```
|
||
|
||
---
|
||
|
||
## 📁 Maildir Setup
|
||
|
||
```bash
|
||
mkdir -p ~/Maildir/{cur,new,tmp}
|
||
```
|
||
|
||
### Structure:
|
||
|
||
```text
|
||
Maildir/
|
||
├── cur/ # Read messages
|
||
├── new/ # New messages
|
||
└── tmp/ # Temporary storage
|
||
```
|
||
|
||
<EFBFBD><EFBFBD> Example:
|
||

|
||
|
||
---
|
||
|
||
## 🔄 Restart Service
|
||
|
||
```bash
|
||
sudo systemctl restart dovecot
|
||
```
|
||
|
||
---
|
||
|
||
## ✅ Check Status
|
||
|
||
```bash
|
||
systemctl status dovecot
|
||
```
|
||
|
||
📸 Output:
|
||

|
||
|
||
---
|
||
|
||
## 🌐 Check Ports
|
||
|
||
```bash
|
||
sudo ss -tulpn | grep dovecot
|
||
```
|
||
|
||
Ports:
|
||
|
||
* 143 → IMAP
|
||
* 993 → IMAP SSL
|
||
|
||
---
|
||
|
||
## 🔐 Authentication Test
|
||
|
||
```bash
|
||
sudo doveadm auth test gebely 5095
|
||
```
|
||
|
||
📸 Output:
|
||

|
||
|
||
---
|
||
|
||
## 📡 IMAP Testing
|
||
|
||
```bash
|
||
openssl s_client -connect localhost:143 -starttls imap
|
||
```
|
||
|
||
Login:
|
||
|
||
```text
|
||
a login gebely 5095
|
||
```
|
||
|
||
---
|
||
|
||
## 📬 IMAP Commands
|
||
|
||
```text
|
||
b LIST "" "*"
|
||
c SELECT INBOX
|
||
d FETCH 1 BODY[]
|
||
```
|
||
|
||
📸 IMAP Session:
|
||

|
||
|
||
---
|
||
|
||
## 🧠 Architecture
|
||
|
||
```text
|
||
Client → Dovecot → PAM → passwd → Maildir
|
||
```
|
||
|
||
---
|
||
|
||
## ⚙️ Configuration Summary
|
||
|
||
* Mail storage: Maildir
|
||
* Authentication: PAM
|
||
* User database: passwd
|
||
* Protocol: IMAP
|
||
* SSL enabled
|
||
|
||
---
|
||
|
||
## 🚨 Troubleshooting
|
||
|
||
### 1. Port already in use
|
||
|
||
```bash
|
||
sudo netstat -tulpn | grep 143
|
||
```
|
||
|
||
---
|
||
|
||
### 2. Network issue (VM)
|
||
|
||
* Enable VMware NAT
|
||
* Start VMware NAT Service
|
||
|
||
---
|
||
|
||
### 3. Authentication failure
|
||
|
||
* Check username/password
|
||
* Verify PAM configuration
|
||
|
||
---
|
||
|
||
## 🎯 Status
|
||
|
||
✅ Dovecot installed
|
||
✅ Maildir configured
|
||
✅ Authentication working
|
||
✅ IMAP tested successfully
|