LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-12-2007, 09:11 AM   #1
yogaboy2
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Rep: Reputation: 0
Get list of emails through telnet


Hi,

I'm trying to get a list of the message in a user's email account, so that I can do some data extraction with perl on the entire list.

So, I thought I might get the list into perl by connecting via telnet to the Exim server. I'm trying it "by hand" before I write the script.
I can authenticate but I'm unsure of how to see the list of messages.


I don't run the email server, can't get any scripts onto it. Our company bought the user's business and he hosts his mail elsewhere until we can migrate him, but I've got work to do in the meantime!


Any insight is much appreciated.
 
Old 11-12-2007, 01:31 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Does the server support IMAP? YOu may be able to send IMAP commands to the server to do this. The RFC at http://www.isi.edu/in-notes/rfc3501.txt describes communication with the server.
 
Old 11-13-2007, 04:28 AM   #3
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
mutt can make complex search on emails. But I don't know if it can be done through imap (so that you don't need to locally download all messages). If they are local then mutt could help you.
Otherwise, I would look at the rfc as mentionned above and DIY..
 
Old 11-13-2007, 06:14 AM   #4
senramesh
LQ Newbie
 
Registered: May 2007
Posts: 21

Rep: Reputation: 15
Try the below method to list the mails in a mailbox, using telnet...

$ telnet thedomain.com 110
Trying 69.36.162.5...
Connected to thedomain.com.
Escape character is '^]'.
+OK Qpopper (version 4.0.4, modified by Sphera Technologies) ready.
USER janedoe@thedomain.com
+OK Password required for janedoe.
PASS topsecret
+OK janedoe has 5 visible messages (0 hidden) in 39867 octets.
LIST
+OK 5 visible messages (39867 octets)
1 8132
2 10101
3 11861
4 5710
5 4063
.
QUIT
+OK Pop server at thedomain.com signing off.

Connection closed by foreign host.
 
Old 12-09-2007, 06:09 PM   #5
yogaboy2
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Original Poster
Rep: Reputation: 0
#!/usr/bin/perl
sorry for not replying immediately - i meant to but then was deluged with work and am only now getting through the backlog!

Thanks for all the tips, here is the perl script I finally used that worked for me. Again, thanks for taking the time to reply, it really is much appreciated.

use warnings;
use strict;
use Mail::POP3Client;

my $pop = new Mail::POP3Client( USER => "myaddress\@mydomain.com"
, PASSWORD => "password"
, HOST => "mail.mydomain.com" );
for (my $i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->Head( $i ) ) {
/^(From|Subject):\s+/i and print $_, "\n";
}
print "\n";
}
 
  


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
sending emails using telnet ddaas Linux - Networking 6 10-30-2007 05:15 AM
Replying to emails on a mailing list OlRoy General 5 01-28-2007 09:53 AM
program to filter valid emails out of a list?? ALInux General 1 12-17-2005 10:52 AM
Send emails to list in text file using RedHat9 MrEase Linux - Newbie 1 04-24-2004 07:35 PM
Sending mass emails to a list of users - how? W1pEout[64] Programming 4 01-08-2004 11:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:38 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