Home > HowTo, Linux, PerlScripts, Security > GetMail from command line

GetMail from command line

November 12th, 2008 Leave a comment Go to comments

.
.
Getting email from the command line was always something I wanted, also to be able to filter what I get.
This great tool is something like fetchmail but better, thanks to Charles Cazabon who wrote this amazing tool in python. Here is more info http://pyropus.ca/software/getmail/
Later I could even have it scripted, if I need to search my emails, it should download the mailbox (without any attachments) and then search for a string within all emails. Well its not all done, but I believe I found the correct tools for it. Hope to come up with nice script in the future.

Download here
Compile doing:
# python setup.py install
Test it:
# getmail –help

The configuration file, /home/user/getmailtes:

[retriever]
type = SimplePOP3Retriever
server = mail.caca.com
username = fudido@caca.com
port = 110
password = vouentrar
use_apop = false
timeout = 60
delete_dup_msgids = true
dont-delete = true
message_log = ~/Mailbox/log
verbose = 2

[destination]
type = Maildir
path = ~/Mailbox/
arguments = (“–strip-forbidden-attachments”)

note: the “strip-forbidden-attachments” Is not working, I wanted to avoid downloading attachments.Anybody can do it?
To run getmail:
# getmail --rcfile /home/user/getmailtest --getmaildir /home/user/Mailbox

Be sure to create three folder inside the Mailbox directory: cur, tmp, new and give permissions.
Should be able to see the emails being downloaded “delivered”.

  • Read the Configuration getmail manual here.
  • Read the Documentation getmail manual here.
    1. No comments yet.
    1. No trackbacks yet.

    VAMOVE *

    *