LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 04-29-2007, 09:00 PM   #1
Chryzmo
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 10.1
Posts: 180

Rep: Reputation: 30
Library To Access POP3 Server


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
 
Old 04-30-2007, 03:00 AM   #2
haxpor
Member
 
Registered: Dec 2006
Distribution: Ubuntu 20.04
Posts: 87

Rep: Reputation: 15
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.

 
Old 04-30-2007, 06:31 PM   #3
cfaj
Member
 
Registered: Dec 2003
Location: Toronto, Canada
Distribution: Mint, Mandriva
Posts: 221

Rep: Reputation: 31
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
 
Old 04-30-2007, 10:39 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
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
 
  


Reply



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 02:14 AM
Access POP3 behind proxy? r_emu General 0 07-28-2006 04:18 AM
limit access pop3 server RHEL 4 nasim2 Red Hat 0 02-02-2006 04:38 PM
pop3 access drewskiamk Linux - Software 18 11-12-2003 08:34 PM
pop3 access bradyc Linux - Newbie 6 10-28-2003 02:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:21 PM.

Main Menu
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