Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Main Support Categories > General Help
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

General Help
All your general support questions for Ubuntu, Kubuntu, Edubuntu and Xubuntu.

 
Thread Tools Display Modes
Old July 25th, 2008   #1
kaivalagi
Chocolate Ubuntu Mocha Blend
 
kaivalagi's Avatar
 
Join Date: Feb 2008
Location: 52°38'41.6"N/1°19'43.6"E
Beans: 1,916
Conky SSL Email Python Script

ArchLinux : Package support is present in the AUR. All my packages can be seen here: http://aur.archlinux.org/packages.php?SeB=m&K=kaivalagi

IMPORTANT NEWS

All the script packages have now been copied into the Conky Hardcore PPA. Any package updates will be provided by the team through this new ppa.

The ppa can be found here: https://launchpad.net/~conkyhardcore/+archive/ppa

To use this ppa first delete the old ppa files using this:
Code:
sudo rm /etc/apt/sources.list.d/m-buck*
Then follow the modified first post instructions for the scripts
__________________________________________________ __________________________________________________ ______________________________


Intro

This is a simple script to return the count of emails in an inbox, it supports SSL (secure) and standard connections to IMAP and POP3 services on the standard port numbers.

Currently a mail message count of unread emails is returned for IMAP accounts, for POP3 accounts I still need to figure out how I will provide this, currently the total email count is returned. POP3 is a very old and limited protocol, hence the issues.

There is a README with the install and attached here, I suggest you give it atleast a quick once over!

Basic Install

Method 1: Using apt

1) Create the necessary list file for access to the repository by running one of these.

Karmic Koala:
Code:
sudo wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-karmic.list -O /etc/apt/sources.list.d/conkyhardcore-karmic.list
Jaunty Jackalope:
Code:
sudo wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-jaunty.list -O /etc/apt/sources.list.d/conkyhardcore-jaunty.list
Intrepid Ibex:
Code:
sudo wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-intrepid.list -O /etc/apt/sources.list.d/conkyhardcore-intrepid.list
Hardy Heron:
Code:
sudo wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-hardy.list -O /etc/apt/sources.list.d/conkyhardcore-hardy.list
2) Add the repository public key to your apt setup by running this:

Code:
wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-key.gpg -O- | sudo apt-key add -
3) Now that is done simply run the following to install

Code:
sudo apt-get update && sudo apt-get install conkyemail
Method 2: Using deb file

Download and run the attached .deb file

Warning, this will not ensure you are kept up-to-date. Only method 1 will do that

Method 3: Using tar.gz file

Extract all the contents of the attached tar.gz file to an appropriate folder, and edit the conkyEmail script to point to the correct location where conkyEmail.py is.

Unless you are using a non-Debian based OS I don't suggest this. Users of Debian/Ubuntu flavour OS's should ideally use method 1.

Again will will not receive updates using this method. ONLY method 1 can do this for you

All further details on setup are orientated around the deb package based install, so may differ from what you choose your setup to be, if done using the tarball.


Usage Help

You can get the current help options at any time by running (change the path as necessary):

Code:
conkyEmail -h
or

Code:
conkyEmail --help
Code:
Usage: conkyEmail [options]
Options:
  -h, --help            show this help message and exit
  -m SERVERTYPE, --servertype=SERVERTYPE
                        servertype to check [default: POP] The server type
                        options are POP or IMAP
  -s SERVERNAME, --servername=SERVERNAME
                        server name to access [default: pop.mail.yahoo.co.uk]
                        The server name should be either a domain name or ip
                        address
  -o NUMBER, --port=NUMBER
                        Define an alternative port number to use other than
                        the default for the protocol/ssl
  -f FOLDER, --folder=FOLDER
                        [default: Inbox] IMAP folder to check, not applicable
                        for POP mail checks
  -e, --ssl             Use an SSL based connection.
  -u USERNAME, --username=USERNAME
                        username to login with
  -p PASSWORD, --password=PASSWORD
                        Password to login with
  -t FILE, --template=FILE
                        define a template file to generate output in one call.
                        A displayable item in the file is in the form
                        [--servertype=IMAP --ssl --servername=imap.gmail.com
                        --folder=Inbox --username=joebloggs
                        --password=letmein, --connectiontimeout=10]. Note that
                        the short forms of the options are not currently
                        supported! None of these options are applicable at
                        command line when used in templates.
  -i NUMBER, --mailinfo=NUMBER
                        [default: 0] The number of newest emails to output
                        'from' and 'subject' information for. Not applicable
                        at command line when using templates.
  -w NUMBER, --maxwidth=NUMBER
                        [default: 80] Define the number of characters to
                        output per line
  -l NUMBER, --linelimit=NUMBER
                        [default: 0] If above zero this limits the number of
                        lines output for mail info
  -q CHAR, --quote=CHAR
                        [default: "] The character to use for quotations
                        around the subject line
  -c NUMBER, --connectiontimeout=NUMBER
                        [default: 10] Define the number of seconds before a
                        connection timeout can occur. Not applicable at
                        command line when using templates.
  -v, --verbose         request verbose output, not a good idea when running
                        through conky!
  -V, --version         Displays the version of the script.
  --errorlogfile=FILE   If a filepath is set, the script appends errors to the
                        filepath.
  --infologfile=FILE    If a filepath is set, the script appends info to the
                        filepath.
The important thing to note now is that the script is called using this in Conky:

Code:
{execi 1800 conkyEmail ...options...}
Rather than something like this as before:

Code:
{execi 1800 python /path/to/file/conkyEmail.py ...options...}

Development History

Development history going forwards can be seen here https://code.launchpad.net/~m-buck/+junk/conkyemail

All packages available from me can be found here: https://launchpad.net/~conkyhardcore/+archive/ppa

I have also created a new website, for now it is relatively sparse, but it does details my conky scripts to a certain degree. You can find it here: http://www.kaivalagi.com
Attached Images
File Type: jpg conkyEmail.jpg (8.5 KB, 1416 views)
Attached Files
File Type: txt README.txt (5.5 KB, 293 views)
File Type: deb conkyemail_2.07_all.deb (15.3 KB, 82 views)
File Type: gz conkyemail-2.07.tar.gz (23.8 KB, 156 views)
__________________

Last edited by kaivalagi; 4 Weeks Ago at 06:07 AM.. Reason: Updated script, see dev history
kaivalagi is offline   Reply With Quote
Old July 25th, 2008   #2
Bruce M.
Chocolate Ubuntu Mocha Blend
 
Bruce M.'s Avatar
 
Join Date: Sep 2007
Location: 34°35'S - 58°21'W
My beans are hidden!
Re: Conky SSL Email Python Script

Hi kaivalagi,

I never realized there was a problem with the POP3 stuff as I use:

Code:
${color1}Hay  ${color4}${execi 60 python /home/my_name/Conky/scripts/mail/conkyEmail.py --servertype=POP --servername=pop3.my_isp.com --username=my_name --password=my_password}  ${color1}E-mail$color
and my setup "deletes mail" from the server when I download it.

That works for me.
CHIMO!
Bruce

EDIT: Hey, I just realized, I have a gmail account as well and it's set to a POP3 account, I can use this there too. (I only want a number anyway).

Last edited by Bruce M.; July 25th, 2008 at 09:28 AM..
Bruce M. is offline   Reply With Quote
Old July 25th, 2008   #3
kaivalagi
Chocolate Ubuntu Mocha Blend
 
kaivalagi's Avatar
 
Join Date: Feb 2008
Location: 52°38'41.6"N/1°19'43.6"E
Beans: 1,916
Re: Conky SSL Email Python Script

Quote:
Originally Posted by Bruce M. View Post
Hi kaivalagi,

I never realized there was a problem with the POP3 stuff as I use:

Code:
${color1}Hay  ${color4}${execi 60 python /home/my_name/Conky/scripts/mail/conkyEmail.py --servertype=POP --servername=pop3.my_isp.com --username=my_name --password=my_password}  ${color1}E-mail$color
and my setup "deletes mail" from the server when I download it.

That works for me.
CHIMO!
Bruce

EDIT: Hey, I just realized, I have a gmail account as well and it's set to a POP3 account, I can use this there too. (I only want a number anyway).
POP3 doesn't have an unread mail count feature, for that I'd need to keep track of all the emails to understand what is read and what is not, not easy outside of the main mail client used...POP3 is ancient really, outdated and should be disregarded as a protocol.

I recommend switching your gmail account to IMAP based rather then POP...it is more secure generally, and with SSL as well is the bee's knees

You can do this via the google mail settings online, and then it's a simple case of changes your account setting in thunderbird/evolution etc...

Your call though, just a recommendation...
__________________

Last edited by kaivalagi; July 25th, 2008 at 01:26 PM..
kaivalagi is offline   Reply With Quote
Old July 25th, 2008   #4
Bruce M.
Chocolate Ubuntu Mocha Blend
 
Bruce M.'s Avatar
 
Join Date: Sep 2007
Location: 34°35'S - 58°21'W
My beans are hidden!
Re: Conky SSL Email Python Script

Quote:
Originally Posted by kaivalagi View Post
I recommend switching your gmail account to IMAP based rather then POP...it is more secure generally, and with SSL as well is the bee's knees

You can do this via the google mail settings online, and then it's a simple case of changes your account setting in thunderbird/evolution etc...

Your call though, just a recommendation...
Thanks K, I'll definately check that out. Don't have an option with my ISP though, I think they only provide POP3. However I will check that out as well.

Regardless, I never leave mails on my server, they are deleted when I download them.

CHIMO!
Bruce
Bruce M. is offline   Reply With Quote
Old August 24th, 2008   #5
PurposeOfReason
100% Pure Ubuntu
 
PurposeOfReason's Avatar
 
Join Date: May 2007
Location: Washington
Beans: 914
Send a message via AIM to PurposeOfReason
Re: Conky SSL Email Python Script

Hey, I've been trying to get this to work with my uni and gmail but it always says there are 0 new. Both using IMAP and google is configured right.
PurposeOfReason is online now   Reply With Quote
Old August 25th, 2008   #6
wariskampar
Ubuntu Extra Shot
 
Join Date: Apr 2008
Beans: 382
Re: Conky SSL Email Python Script

Same thing here I use ivleph's script and it works great.
wariskampar is offline   Reply With Quote
Old August 25th, 2008   #7
kaivalagi
Chocolate Ubuntu Mocha Blend
 
kaivalagi's Avatar
 
Join Date: Feb 2008
Location: 52°38'41.6"N/1°19'43.6"E
Beans: 1,916
Re: Conky SSL Email Python Script

Quote:
Originally Posted by PurposeOfReason View Post
Hey, I've been trying to get this to work with my uni and gmail but it always says there are 0 new. Both using IMAP and google is configured right.
I'll take a look at some point soon, it used to work...? And nothing is changed ??
__________________
kaivalagi is offline   Reply With Quote
Old August 25th, 2008   #8
kaivalagi
Chocolate Ubuntu Mocha Blend
 
kaivalagi's Avatar
 
Join Date: Feb 2008
Location: 52°38'41.6"N/1°19'43.6"E
Beans: 1,916
Re: Conky SSL Email Python Script

UPDATE

Fixed the issue with IMAP counts not working properly, grab the tarball from this post.

I switched to using the "UNSEEN" IMAP search filter instead of "RECENT", recent no longer works as desired?


OPTIONAL

I have updated the first post, as conkyEmail is now available from my personal package archive at launchpad. If you install it this way you'll get any updates with minimal fuss...

Just bear in mind you'll need to change the conky calls from:

Code:
${execi 1800 python /path/to/script conkyEmail.py ...options...}
to:

Code:
${execi 1800 conkyEmail ...options...}
More extensive details to come shortly...
__________________

Last edited by kaivalagi; January 15th, 2009 at 04:29 AM..
kaivalagi is offline   Reply With Quote
Old August 25th, 2008   #9
PurposeOfReason
100% Pure Ubuntu
 
PurposeOfReason's Avatar
 
Join Date: May 2007
Location: Washington
Beans: 914
Send a message via AIM to PurposeOfReason
Re: Conky SSL Email Python Script

Thank you, it works great now!
PurposeOfReason is online now   Reply With Quote
Old August 25th, 2008   #10
kaivalagi
Chocolate Ubuntu Mocha Blend
 
kaivalagi's Avatar
 
Join Date: Feb 2008
Location: 52°38'41.6"N/1°19'43.6"E
Beans: 1,916
Re: Conky SSL Email Python Script

Quote:
Originally Posted by PurposeOfReason View Post
Thank you, it works great now!
Did you use the new apt based install?

It's working well for conkyForecast...
__________________
kaivalagi is offline   Reply With Quote

Bookmarks

Tags
conky, email, python, script, ssl

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:18 PM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry