在 CentOS 上“重置邮件服务器”通常指以下几种情况之一,我分别说明,你可以对号入座:
常见邮件服务软件:
请先确认:
rpm -qa | grep -E "postfix|sendmail|exim|dovecot"
systemctl stop postfix
cp -r /etc/postfix /etc/postfix.bak
rm -rf /etc/postfix
yum reinstall postfix -y
或手动恢复默认:
cp -r /usr/share/doc/postfix-*/examples/* /etc/postfix/
postfix set-permissions
postfix check
systemctl start postfix
systemctl enable postfix
⚠️ 这会删除所有未发送邮件
postsuper -d ALL
或强制清空:
rm -rf /var/spool/postfix/*
systemctl restart postfix
rm -rf /var/mail/*
rm -rf /home/*/Maildir/*
systemctl stop dovecot
cp -r /etc/dovecot /etc/dovecot.bak
yum reinstall dovecot -y
systemctl start dovecot
如果你是用 宝塔 / iRedMail / ExtMail 等:
cd /root/iRedMail-*
./iRedMail.sh
或重装系统最干净。
bt
# 选择 邮件管理 → 卸载
passwd 用户名
mysql -u root -p
请告诉我:
我可以给你精确命令,不误删数据。