Last active
January 23, 2024 15:31
-
-
Save fumionaito/98495b3ce5dfea1a2b58 to your computer and use it in GitHub Desktop.
Script to delete all mails on POP3 server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect | |
set timeout 20 | |
spawn telnet $env(POP3_SERVER) $env(POP3_PORT) | |
expect +OK; send "USER $env(POP3_USER)\r" | |
expect +OK; send "PASS $env(POP3_PASS)\r" | |
expect +OK; send "STAT\r" | |
set x 1 | |
while { $x <= 10000 } { | |
expect +OK { | |
send "DELE $x\r" | |
incr x 1 | |
} ERR { | |
send "QUIT\r" | |
exit | |
} | |
} | |
expect +OK; send "QUIT\r" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment