LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org
User Name
Password

Notices


By dr_agon at 2008-10-13 16:46
applies to: KMail, Evolution, Perl, POP3, mail client

Unfortunatelly my favourite mail client (Kmail) cannot leave messages on the POP3 server while retrieving them and delete them later, eg. when they are moved to 'Trash" folder (like Thunderbird). The same applies to Evolution. Of course I know there are IMAP servers, but that's not the solution I like most. I also did not want to periodically erase all messages left on POP3 server. I did not find any reasonable solution, so I made it myself. It is available as DeleteFromPOP3 project at Sourceforge.net(tm).

The idea is simple:
  1. mark messages for deleting in the mail client - It is not so difficult to do it manually. I just delete mails from my inbox or mark them as spam. Then, from time to time I mark all files in the trash and spam folder for removal from POP3 server. When you create a mail filter and add it to the toolbar, it just requires one click to mark messages for removal.
  2. pass the list of messages marked for deletion to the external program - This is done together with marking for removal. No additional action required.
  3. run external program to delete messages from the server - You can run it automatically if you wish.
To achieve this, I wrote two Perl scripts, and created a mail filter in Kmail.
How it works
  • A filter is invoked which executes a helper script passing the message as input.
  • A message from mail client is parsed and information needed for
    identification of message on the server is collected.
    The script produces a pair of <host name> and <Message-Id> for
    every message.
    The pairs of <host name> and <Message-Id> are stored in
    separate file, each in separate line
  • The second script, which actually deletes messages from POP3
    server, is executed whenever you like.
    This script requires a list of messages created by previous
    script.
    It also requires POP3 account details to connect to server(s).
    After connecting to the POP3 server it looks through all
    messages and checks if a message is on the list and should be
    deleted.
    After deleting messages it truncates the message list file.

This may not be the best solution, but it works for me, and there is a good chance it will work for others, too. Any comments are welcomed.

Enjoy.


  



All times are GMT -5. The time now is 01:38 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration