WildDuck is a scalable no-SPOF IMAP/POP3 mail server.
WildDuck uses a distributed database (sharded + replicated MongoDB) as a backend for storing all data, including emails.
WildDuck tries to follow Gmail in product design. If there's a decision to be made then usually the answer is to do whatever Gmail has done.
- onConnect/onClose Handlers: Full support for custom connection handling in both IMAP and POP3 servers
- IP-based connection filtering and rate limiting
- Custom authentication and authorization logic
- Connection monitoring and logging capabilities
- Backward compatible - handlers are optional
- Smart Timeout Management: POP3 connections now automatically reset timeouts during active command processing
- Prevents unexpected disconnections during legitimate usage
- Maintains security timeouts for idle connections
- Seamless operation with existing timeout configurations
- RFC 4551 Compliance: Full CONDSTORE (Conditional STORE) extension support
- ENABLE CONDSTORE extension
- STORE and UID STORE with UNCHANGESINCE modifier
- MODIFIED response codes for conflict detection
- Enhanced synchronization capabilities for modern email clients
const { IMAPServer } = require('wildduck/imap-core');
const server = new IMAPServer({
// Connection filtering and rate limiting
onConnect: (session, callback) => {
// Block specific IPs
if (blockedIPs.includes(session.remoteAddress)) {
return callback(new Error('IP blocked'));
}
// Rate limiting
if (connectionCount[session.remoteAddress] > 10) {
return callback(new Error('Too many connections'));
}
console.log(`New IMAP connection from ${session.remoteAddress}`);
callback();
},
// Connection cleanup
onClose: (session) => {
console.log(`IMAP connection closed: ${session.id}`);
// Custom cleanup logic here
}
});
const POP3Server = require('wildduck/lib/pop3/server');
const server = new POP3Server({
// Enhanced timeout handling (automatic)
socketTimeout: 300000, // 5 minutes
// Connection filtering
onConnect: (session, callback) => {
// Custom authentication logic
if (!isAllowedConnection(session)) {
return callback(new Error('Connection not allowed'));
}
callback();
},
// Connection monitoring
onClose: (session) => {
logConnectionStats(session);
}
});
// Enable CONDSTORE extension
A1 ENABLE CONDSTORE
// Conditional STORE operations
A2 STORE 1:5 (UNCHANGEDSINCE 12345) +FLAGS (\Seen)
// Response: A2 OK [MODIFIED 3,5] Conditional STORE completed
// UID STORE with UNCHANGEDSINCE
A3 UID STORE 100:200 (UNCHANGEDSINCE 67890) FLAGS (\Deleted)
// Response: A3 OK [MODIFIED 150,175] Conditional STORE completed
WildDuck Mail Server is licensed under the European Union Public License 1.2 or later.
WildDuck Mail Server is part of the Zone Mail Suite (ZMS). Suite of programs and modules for an efficient, fast and modern email server.
Copyright (c) 2024 Zone Media OÜ