LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   shell script to delete alla messages from pop3 server? (https://www.linuxquestions.org/questions/linux-software-2/shell-script-to-delete-alla-messages-from-pop3-server-945111/)

acidrop 05-15-2012 12:15 PM

shell script to delete alla messages from pop3 server?
 
Hello

I am looking for a shell script to totally remove (empty) all messages from
a specific account on a pop3 mail server.
Tried this one but it didn't work.

Any suggestions?

pan64 05-15-2012 01:11 PM

if you know user/pass you can log in and delete all.
What is the problem with that solution?

acidrop 05-15-2012 01:14 PM

Quote:

Originally Posted by pan64 (Post 4679160)
if you know user/pass you can log in and delete all.
What is the problem with that solution?

there are more than 56000 mails... can i delete them at once via telnet??

pan64 05-15-2012 01:24 PM

as you see the script deletes messages one by one. If you have time it will do the job. In GUI probably you can mark 20 or 50 in one and delete them. Optionally you can delete user account and create it again. I do not see any way to execute a "delete-all" command. If there was a such command the mail server provider would help you.

acidrop 05-15-2012 01:27 PM

Quote:

Originally Posted by pan64 (Post 4679172)
as you see the script deletes messages one by one. If you have time it will do the job. In GUI probably you can mark 20 or 50 in one and delete them. Optionally you can delete user account and create it again. I do not see any way to execute a "delete-all" command. If there was a such command the mail server provider would help you.

tried the script but i get:

+OK Send your password
+OK Mailbox locked and ready
./clean.pop3: 11: Syntax error: Bad for loop variable
Connection closed by foreign host.

I use the following syntax: ./clean.pop3 1000 | telnet pop3sever 110

273 05-15-2012 01:30 PM

I think this is what "expect" is for but I've never used it myself so can't be any help other than to say google it, sorry.
Edit: Did you try hard coding the "1000" into the script rather than entering it on the command line?

acidrop 05-15-2012 01:37 PM

Did you try hard coding the "1000" into the script rather than entering it on the command line?

do you know how can i do that? i don't have scripting knowledge...

pan64 05-15-2012 01:38 PM

Quote:

Originally Posted by acidrop (Post 4679173)
tried the script but i get:

+OK Send your password
+OK Mailbox locked and ready
./clean.pop3: 11: Syntax error: Bad for loop variable
Connection closed by foreign host.

I use the following syntax: ./clean.pop3 1000 | telnet pop3sever 110

probably you need to try #!/bin/bash in the first line

acidrop 05-15-2012 01:40 PM

Quote:

Originally Posted by pan64 (Post 4679192)
probably you need to try #!/bin/bash in the first line

thank you!!!! that worked... thank you very much :)

273 05-15-2012 01:46 PM

Quote:

Originally Posted by pan64 (Post 4679192)
probably you need to try #!/bin/bash in the first line

I feel stupid now, I didn't even look at the top of the script.

pan64 05-15-2012 11:23 PM

Quote:

Originally Posted by 273 (Post 4679202)
I feel stupid now, I didn't even look at the top of the script.

you have learned a lesson now.

Happy with solution ... mark as SOLVED

If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.


All times are GMT -5. The time now is 03:01 PM.