How to Fix Postfix Mailbox Full Error
In this tutorial, you'll learn about How to Fix Postfix Mailbox Full Error. We cover key concepts, practical examples, and best practices.
Postfix returns mailbox is full or quota exceeded when delivering mail to local users — the mailbox has reached its storage limit or the disk where mail is stored is full.
The Problem
Jun 24 10:00:00 mail postfix/local[1234]: 9A1B2C3D4E5F:
to=<user@example.com>, relay=local, delay=0.5,
status=bounced (mailbox is full)
Step-by-Step Fix
Step 1: Check disk space
df -h /var/mail
df -h /var/spool/mail
Step 2: Check user mailbox size
sudo du -sh /var/mail/user
# Or for maildir format
sudo du -sh /home/user/Maildir/
Step 3: Clear the mailbox
# Move old emails to archive
sudo mv /var/mail/user /var/mail/user.old
# Or truncate (backup first!)
# Create a new empty mailbox
sudo touch /var/mail/user
sudo chown user:mail /var/mail/user
Step 4: Set mailbox size limits
# /etc/postfix/main.cf
mailbox_size_limit = 512000000 # 512 MB
virtual_mailbox_limit = 512000000
message_size_limit = 25600000 # 25 MB
Step 5: Configure quota warnings
# Install quota tools
sudo apt-get install quota
# Send warning when 90% full
sudo quota -w 90%
Step 6: Set up automatic cleanup
# Create a cron job to clean old emails
0 3 * * * find /var/mail -name "cur/*" -mtime +180 -delete
Prevention Tips
- Set realistic
mailbox_size_limitvalues in main.cf - Monitor disk usage on mail partitions with alerts at 80%
- Use Maildir format for easier per-user quota management
- Archive old emails automatically with cron
Common Mistakes with mailbox full
- Non-exhaustive pattern matches that compile with warnings then crash at runtime
- Misunderstanding that
Stringis[Char]with poor performance for large text operations - Using
foldlinstead offoldl'causing stack overflow on large lists
These mistakes appear frequently in real-world POSTFIX code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro