A bad change in sendmail has generated mailbox files instead of writing emails in maildir. We have roll-backed the change and emails are now well delivered in mailboxes. But, emails in mailbox files remain, and I am looking for a way to requeue those emails, so that they can be deliver into maildir.
Asked
Active
Viewed 271 times
0
-
Hi. I am reviewing your post. Your question is good, but to help the community help you, it is always a good idea to add some code. – rainer May 09 '20 at 21:13
-
Hi. Thank you, but it is a general question, so need to add specific code. – Roger Yerbanga May 11 '20 at 01:10
2 Answers
0
Finally, I used mb2md (http://manpages.ubuntu.com/manpages/eoan/en/man1/mb2md.1.html) to convert all those mailboxes to maildirs, then copied different emails inside new created maildirs to respective users maildirs.
Script looks like this code :
#!/bin/bash
cd /var/spool/mail/
for dir in $( ls ); do
/root/bin/mb2md -s /var/spool/mail/$dir -R -d /root/tmp/$dir
sleep 60
chown $dir.users /root/tmp/$dir/cur/*
chmod 600 /root/tmp/$dir/cur/*
sleep 60
dir2=$(getent passwd $dir |awk -F: '{print $6}')
echo "cp -a /root/tmp/$dir/cur/* $dir2/Maildir/new/"
cp -av /root/tmp/$dir/cur/* $dir2/Maildir/new/
done;
0
Another solution is described there : http://giantdorks.org/alain/resend-mail-thats-locally-stored-in-a-mbox-format-on-a-linux-box-to-a-working-email-address/
It uses formail to detach emails and sendmail to resend them.