File indexing completed on 2024-11-24 04:53:30

0001 #!/bin/bash
0002 
0003 echo "Warning: this will nuke your Dovecot's INBOX!"
0004 echo "Press Ctrl-C IMMEDIATELLY if you don't want to proceed."
0005 echo
0006 echo "Press Enter to continue AND LOOSE ALL DATA."
0007 read
0008 
0009 send_mail() {
0010     echo -e "From: jkt@flaska.net\r\n"\
0011 "To: jkt@flaska.net\r\n"\
0012 "Subject: $1\r\n"\
0013 "Date: dneska\r\n\r\nblesmrt 333 666\r\n"| /usr/libexec/dovecot/deliver -e
0014 }
0015 
0016 delete_sequence() {
0017     (
0018     echo -e "1 SELECT INBOX\r\n2 STORE $1 +FLAGS (\\deleted)\r\n"\
0019 "3 EXPUNGE\r\n4 LOGOUT\r\n"; sleep 1) | dovecot --exec-mail imap >/dev/null
0020     echo
0021 }
0022 
0023 send_mail X
0024 
0025 echo "Mailbox contents: X"; read
0026 
0027 delete_sequence "1"
0028 send_mail Y
0029 send_mail Z
0030 
0031 echo "Mailbox contents: Y Z"; read
0032 
0033 delete_sequence "1:*"
0034 
0035 echo "Mailbox is empty now and that's all :)"; read