To Gain Knowledge and to become a one, who all wants to become

Dreams are not those which are seen during sleep ,but Dreams are those which do not let you sleep,so see the dreams
and work hard to make them true.

Monday, December 31, 2012

Getting your Gmail Emails (using pop/imap) in linux box using fetchmail :

1. Get the SSL Certificate for connecting to Gmail POP3-over-SSL (pop3s) :

    # cd /usr/share/ssl/certs
    # chmod 644 Equifax_Secure_Certificate_Authority.pem
    # openssl x509 -in Equifax_Secure_Certificate_Authority.pem -fingerprint -subject -issuer -serial -hash -noout
    # c_rehash . (c_rehash command will be available with openssl-perl package)
    # file 594f1775.* (the name of linked file)


2. Create a .fetchmailrc file in user's home directory and write the following lines :

    poll pop.gmail.com with proto POP3
    user 'username@gmail.com' there with password 'password' is username here
    options keep ssl sslfingerprint 'FF:69:18:0D:75:8C:17:61:F5:EF:FC:F9:85:7D:F5:0E' (this fingerprint will be shown by using fetchmail -v)
    sslcertpath /usr/share/ssl/certs

3. fetchmail -d 600 (The fetchmail utility can be run in daemon mode by running it with the -d flag, followed by the interval in seconds that fetchmail should 
    poll servers listed in the .fetchmailrc file.)

4. You can now check your gmail emails in local users mailbox by using mail user agents like mail,mutt,alpine,etc.