Re: Downloading a message using telnet

From: Arthur Corliss <acorliss@nevaeh-linux.org>
Date: Tue Mar 02 2004 - 00:04:31 PST

On Mon, 1 Mar 2004, Barsalou wrote:

> Is there a way to download a single message using telnet? I just want
> to get one message off of my server and not even touch the others. I
> would like this message to end up in its own file.

I think you need to define your problem a little more. I assume you mean an
e-mail message? Then the answer is yes, provided your server supports POP3 or
IMAP.

Telnet'ing to my POP3 server to retrieve and delete your e-mail would look
like this:

  acorliss@bifrost:~$ telnet localhost pop3
  Trying 127.0.0.1...
  Connected to localhost (127.0.0.1).
  Escape character is '^]'.
  +OK POP3 localhost v2003.83 server ready
  USER acorliss
  +OK User name accepted, password please
  POASS^H^H^H
  -ERR Unknown AUTHORIZATION state command
  PASS yu4Shiung
  +OK Mailbox open, 15 messages
  TOP 15 1
  +OK Top of message follows
  Return-Path: <aklug-bounce@aklug.org>
  Received: from asimov.lib.uaa.alaska.edu (asimov.uaa.alaska.edu
  [137.229.184.11])
          by nevaeh-linux.org (8.12.10/8.12.10) with ESMTP id i226MYb6020794
          for <acorliss@nevaeh-linux.org>; Mon, 1 Mar 2004 21:22:35 -0900
  Received: from asimov (asimov.uaa.alaska.edu [137.229.184.11])
          by asimov.lib.uaa.alaska.edu (Postfix) with ESMTP
          id 932E41C039; Mon, 1 Mar 2004 22:22:43 -0800 (PST)
  Received: with ECARTIS (v1.0.0; list aklug); Mon, 01 Mar 2004 22:22:43 -0800
  (PST)
  X-Original-To: aklug@aklug.org
  Delivered-To: aklug@aklug.org
  Received: from mmp-3.gci.net (mmp-3.gci.net [208.138.130.77])
          by asimov.lib.uaa.alaska.edu (Postfix) with ESMTP id 3C1591C038
          for <aklug@aklug.org>; Mon, 1 Mar 2004 22:22:43 -0800 (PST)
  Received: from [192.168.0.101] (128-92-237-24.gci.net [24.237.92.128])
   by mmp-3.gci.net
   (iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003)) with ESMTP id
   <0HTX0036HR1T1E@mmp-3.gci.net> for aklug@aklug.org; Mon,
   01 Mar 2004 21:22:42 -0900 (AKST)
  Date: Mon, 01 Mar 2004 21:25:33 -0900
  From: Barsalou <barjunk@attglobal.net>
  Subject: Downloading a message using telnet
  To: aklug@aklug.org
  Message-id: <1078208733.2623.1424.camel@localhost.localdomain>
  MIME-version: 1.0
  X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7)
  Content-type: text/plain
  Content-Transfer-Encoding: 8bit
  X-ecartis-version: Ecartis v1.0.0
  Sender: aklug-bounce@aklug.org
  Errors-To: aklug-bounce@aklug.org
  X-original-sender: barjunk@attglobal.net
  Precedence: bulk
  List-help: <mailto:ecartis@lib.uaa.alaska.edu?Subject=help>
  List-unsubscribe: <mailto:aklug-request@aklug.org?subject=unsubscribe>
  List-software: Ecartis version 1.0.0
  List-Id: AKLUG <aklug.asimov>
  X-List-ID: AKLUG <aklug.asimov>
  List-subscribe: <mailto:aklug-request@aklug.org?subject=subscribe>
  List-owner: <mailto:tibor@lib.uaa.alaska.edu>
  List-post: <mailto:aklug@aklug.org>
  X-list: aklug
  X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) on
          bifrost.nevaeh-linux.org
  X-Spam-Level:
  X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham
          version=2.61
  Status: RO

  Is there a way to download a single message using telnet? I just want
  .

  RETR 15
  +OK 2499 octets
  Return-Path: <aklug-bounce@aklug.org>
  Received: from asimov.lib.uaa.alaska.edu (asimov.uaa.alaska.edu
  [137.229.184.11])
          by nevaeh-linux.org (8.12.10/8.12.10) with ESMTP id i226MYb6020794
          for <acorliss@nevaeh-linux.org>; Mon, 1 Mar 2004 21:22:35 -0900
  Received: from asimov (asimov.uaa.alaska.edu [137.229.184.11])
          by asimov.lib.uaa.alaska.edu (Postfix) with ESMTP
          id 932E41C039; Mon, 1 Mar 2004 22:22:43 -0800 (PST)
  Received: with ECARTIS (v1.0.0; list aklug); Mon, 01 Mar 2004 22:22:43 -0800
  (PST)
  X-Original-To: aklug@aklug.org
  Delivered-To: aklug@aklug.org
  Received: from mmp-3.gci.net (mmp-3.gci.net [208.138.130.77])
          by asimov.lib.uaa.alaska.edu (Postfix) with ESMTP id 3C1591C038
          for <aklug@aklug.org>; Mon, 1 Mar 2004 22:22:43 -0800 (PST)
  Received: from [192.168.0.101] (128-92-237-24.gci.net [24.237.92.128])
   by mmp-3.gci.net
   (iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003)) with ESMTP id
   <0HTX0036HR1T1E@mmp-3.gci.net> for aklug@aklug.org; Mon,
   01 Mar 2004 21:22:42 -0900 (AKST)
  Date: Mon, 01 Mar 2004 21:25:33 -0900
  From: Barsalou <barjunk@attglobal.net>
  Subject: Downloading a message using telnet
  To: aklug@aklug.org
  Message-id: <1078208733.2623.1424.camel@localhost.localdomain>
  MIME-version: 1.0
  X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7)
  Content-type: text/plain
  Content-Transfer-Encoding: 8bit
  X-ecartis-version: Ecartis v1.0.0
  Sender: aklug-bounce@aklug.org
  Errors-To: aklug-bounce@aklug.org
  X-original-sender: barjunk@attglobal.net
  Precedence: bulk
  List-help: <mailto:ecartis@lib.uaa.alaska.edu?Subject=help>
  List-unsubscribe: <mailto:aklug-request@aklug.org?subject=unsubscribe>
  List-software: Ecartis version 1.0.0
  List-Id: AKLUG <aklug.asimov>
  X-List-ID: AKLUG <aklug.asimov>
  List-subscribe: <mailto:aklug-request@aklug.org?subject=subscribe>
  List-owner: <mailto:tibor@lib.uaa.alaska.edu>
  List-post: <mailto:aklug@aklug.org>
  X-list: aklug
  X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) on
          bifrost.nevaeh-linux.org
  X-Spam-Level:
  X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham
          version=2.61
  Status: RO

  Is there a way to download a single message using telnet? I just want
  to get one message off of my server and not even touch the others. I
  would like this message to end up in its own file.

  Mike
  --
  Barsalou <barjunk@attglobal.net>

  ---------
  To unsubscribe, send email to <aklug-request@aklug.org>
  with 'unsubscribe' in the message body.
  .
  DELE 15
  +OK Message deleted
  QUIT

Now, please note that I used the TOP command to retrieve the first part of the
e-mail just to make sure I identified the right one. That's an optional
command in the RFC, so your daemon may or may not recognise. In any event,
you can use a succession of TOP commands to locate your e-mail, then RETR and
DELE to retrieve and delete it.

Of course, you're going to need to be tee'ing this to a file or something in
order to actually capture it (or use expect). I'll leave it to you to figure
out an easy sed statement that will extract it from the session. ;-)

The same holds true for IMAP (though the protocol is much more complicated due
to the features it provides--however, it has a *much* better search capability
to quickly locate the e-mail you're looking for).

Ultimately, if you're going to automate such a process you're best off
learning expect, in order to allow it to programmatically search and retrieve
your message.

        --Arthur Corliss
          Bolverk's Lair -- http://arthur.corlissfamily.org/
          Digital Mages -- http://www.digitalmages.com/
          "Live Free or Die, the Only Way to Live" -- NH State Motto
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Tue Mar 2 00:04:58 2004

This archive was generated by hypermail 2.1.8 : Tue Mar 02 2004 - 00:04:58 PST