[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

Read email by a script !

Hi,

Is there a away, a script, can read my emil message and store them in a file and then I can open this file from a Web page, so if I am away from my machine I can read my old+new email messages from this file. I don't know if that possible. Thanks

oualide
0
oualide
Asked:
oualide
  • 4
  • 2
  • 2
1 Solution
 
oualideAuthor Commented:
Edited text of question.
0
 
ozoCommented:
Where do you get your email messages from?  From a file?  From a POP3 server?  From SMTP?
In what language would the script be written?
Would you need to prevent others from reading your mail?
0
 
oualideAuthor Commented:
From pop3 server.
It doesn't matter but Perl is perferable.
I can hide it in my Web server. I mean no link and I put it under a proteted dir which I usualy access by a username + password.


Thanks
oualide
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
ozoCommented:
#you could
use Mail::POP3Client;
#or
use Net::POP3;
0
 
oualideAuthor Commented:
How difficult ?

Will I have control over the my email messages. I mean every time you run the script, can you read only new messages.

Is there an alternative to this approach ?

Thanks

oualide

 
0
 
jhurstCommented:
You can open a connection to your own, or any other pop3 mail server by opening a connection to it using port 110 (the pop3) port and the name of the host.

The commands that you need are then:
user <user-name>
pass <password>
stat - shows what is waiting
retr n - gets message number n
dele n - deletes message n
quit - closes the connection

If you use telnet to your mail server you can test all this and see what your perl needs to do.  I have a script that I use to do exactly what you want, I use it so that I can collect eMail from multiple pop3 boxes and access it from any web-browser.  This way when I am on the road I just get to anyone's browser and check my mail.

Sadly, there is more in the script than I want to give you for somewhat obvious reasons.  But feel free to ask anything that is not clear here.
0
 
oualideAuthor Commented:
jhurst

Thanks for the help butcan you show me a little example in per how to connect and read. I have not seen this anywhere before.
I use perl sometimes anh have books but tis never mentioned.
Thanks agian

oualide
0
 
jhurstCommented:
This works, to show how many messages are waiting:


#!/usr/local/bin/perl
use IO::Socket;
$EOL = "\015\012";
$BLANK = $EOL x 2;
$host="shell1.yourdomain.com";

    $remote = IO::Socket::INET->new( Proto     => "tcp",
                                     PeerAddr  => $host,
                                     PeerPort  => "pop3(25)",
                                    );
    unless ($remote) { die "cannot connect to http daemon on $host" }
    $remote->autoflush(1);
    print $remote "user yourusername" . $EOL;
    print $remote "pass yourpw" . $EOL;
    print $remote "stat" . $EOL;
    print $remote "quit" . $EOL;
    while ( <$remote> ) { print;
    }

    close $remote;
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now