LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Thread Tools Search this Thread
Old 04-29-2007, 10:00 PM   #1
Chryzmo
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 10.1
Posts: 180
Thanked: 0
Library To Access POP3 Server


[Log in to get rid of this advertisement]
Hey all,

I wanted to create a little program that will sit on my desktop or in my taskbar and periodically check to see if I have any new messages in my school inbox.

I was wondering if there might be a library for Java or C++ that would allow me to easily interface with a POP3 e-mail server to determine if there are any messages waiting?

Thanks,
chryzmo
Chryzmo is offline     Reply With Quote
Old 04-30-2007, 04:00 AM   #2
haxpor
Member
 
Registered: Dec 2006
Distribution: Ubuntu 9.10
Posts: 86
Thanked: 0
For Java, it's in 'javax.mail' and also 'javax.activation'. You can find API Doc for it for easy, try to go and search through www.sun.com.

For C++, I dont know it has or not but you can do another way by Programming with Socket API, which actually it's used to send data between hosts but with specific Data Header.(Something like HTTP, such as => Content-Type: text/html\r\n) This make you go to look in rfc doc, http://www.ietf.org.

haxpor is offline     Reply With Quote
Old 04-30-2007, 07:31 PM   #3
cfaj
Member
 
Registered: Dec 2003
Location: Toronto, Canada
Distribution: Mandriva, Ubuntu, LFS, gNewSense
Posts: 221
Thanked: 0
Quote:
Originally Posted by Chryzmo
Hey all,

I wanted to create a little program that will sit on my desktop or in my taskbar and periodically check to see if I have any new messages in my school inbox.

I was wondering if there might be a library for Java or C++ that would allow me to easily interface with a POP3 e-mail server to determine if there are any messages waiting?

You can do it with a shell script:

Code:
#!/bin/bash

user=poppy
passwd=dadsepee
image=$HOME/pics/envelope.jpg
host=mail.somewhere.com
port=110

while :
do
  sleep 60 &
  delay=$!

  CR=$'\r'                            ## carriage return; for removal of
  exec 3<>/dev/tcp/$host/$port        ## connect to POP3 server, port 110
  read ok line <&3                    ## get response from server
  [ "${ok%$CR}" != "+OK" ] && exit 5  ## check that it succeeded
  echo user "$user" >&3               ## send user name
  read ok line <&3                    ## get response
  [ "${ok%$CR}" != "+OK" ] && exit 5  ## check that it succeeded
  echo pass "$passwd" >&3             ## send password
  read ok line <&3                    ## get response
  [ "${ok%$CR}" != "+OK" ] && exit 5  ## check that it succeeded
  echo stat >&3                       ## request number of messages
  read ok num x <&3                   ## get response
  echo quit >&3                       ## close connection

  ##echo Messages: $num                 ## display number of messages

  display "$image" &

  wait $delay
done
cfaj is offline     Reply With Quote
Old 04-30-2007, 11:39 PM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Etch/Lenny/Squeeze
Posts: 2,523
Thanked: 104
You can use fetchmail to check if there is new mail waiting. You should be able to write a periodic check and a pop-up message in almost any script language.

jlinkels
jlinkels is offline     Reply With Quote

Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pop3 access from anywhere ssilayaraja Linux - Networking 2 12-11-2006 03:14 AM
Access POP3 behind proxy? r_emu General 0 07-28-2006 05:18 AM
limit access pop3 server RHEL 4 nasim2 Red Hat 0 02-02-2006 05:38 PM
pop3 access drewskiamk Linux - Software 18 11-12-2003 09:34 PM
pop3 access bradyc Linux - Newbie 6 10-28-2003 03:02 PM


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

Main Menu
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.
Advertisement
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Click Here to receive a complimentary subscription courtesy of LQ.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration