locked
Email To Plain Text. RRS feed

  • Question

  • Sad
    Hi this is anil kumar tumbalam.
    I have writen application in vb .net to read mails from pop3 account. Now i have facing a problem in Reading Message Body [ie. only body of the message].

    Can any body help me.

    Thanks in Advance.

    Thursday, June 23, 2005 11:49 AM

Answers

  • Well..you cannot get the body alone from a POP server...and i cannot agree the header and footer as junk.

    You can parse the text and get the body alone..you can do this by first extracting the text between the boundaries..

    ------=_NextPart_000_0001_01C57024.B0B606A0
    Content-Type: text/plain;
     charset="us-ascii"
    Content-Transfer-Encoding: 7bit

    Date: 28.05.05

    Chennai(Nungambakkam),40.0;

    Chennai(Meenambakkam),40.8;

    Nagapattinam,37.0;


    ------=_NextPart_000_0001_01C57024.B0B606A0

    and then you can easily get the body(for plain text)

    Suresh.


    Tuesday, June 28, 2005 10:34 AM

All replies

  • Hi,

    What is ur problem or what error you are getting?

    Suresh.

    Monday, June 27, 2005 6:04 AM
  • Thanks for your reply,

    Let me explain...
    I have developed any application where it connect to the POP3 Server and gets the List of emails from inbox.

    When i retrive the one email from inbox, it give all Header footer and other parts of the email, which is junk for me.

    I required only Body of the Message.

    Example:
    Return-Path: <anil@genevasoftech.com>
    Delivered-To:
    genevalert@genevafinepunch.com
    Received: (qmail 29154 invoked by alias); 13 Jun 2005 09:13:38 -0000
    Received: (qmail 29148 invoked by uid 504); 13 Jun 2005 09:13:38 -0000
    Received: from
    anil@genevasoftech.com by rainmail.genevafinepunch.com by uid 501 with qmail-scanner-1.21
     (fireav: ???.  Clear:RC:0(192.168.2.11):.
     Processed in 0.074634 secs); 13 Jun 2005 09:13:38 -0000
    Received: from unknown (HELO anil) (
    genevanil@192.168.2.11)
      by 192.168.2.1 with SMTP; 13 Jun 2005 09:13:38 -0000
    Reply-To: <
    anil@genevasoftech.com>
    From: "Tumbalam Anil Kumar" <
    anil@genevasoftech.com>
    To: <
    alert@genevasoftech.com>
    Subject:
    Date: Mon, 13 Jun 2005 14:32:11 +0530
    Organization: Geneva Software Technologies
    Message-ID: <
    000001c56ff6$96fb59a0$0b02a8c0@GENEVASOFTECH.COM>
    MIME-Version: 1.0
    Content-Type: multipart/alternative;
     boundary="----=_NextPart_000_0001_01C57024.B0B606A0"
    X-Priority: 3 (Normal)
    X-MSMail-Priority: Normal
    X-Mailer: Microsoft Outlook, Build 10.0.2616
    Importance: Normal
    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478
    Status: RO

    This is a multi-part message in MIME format.

    ------=_NextPart_000_0001_01C57024.B0B606A0
    Content-Type: text/plain;
     charset="us-ascii"
    Content-Transfer-Encoding: 7bit

    Date: 28.05.05

    Chennai(Nungambakkam),40.0;

    Chennai(Meenambakkam),40.8;

    Nagapattinam,37.0;


    ------=_NextPart_000_0001_01C57024.B0B606A0
    Content-Type: text/html;
     charset="us-ascii"
    Content-Transfer-Encoding: quoted-printable

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
    charset=3Dus-ascii">
    <TITLE>Message</TITLE>

    <META content=3D"MSHTML 6.00.2800.1498" name=3DGENERATOR></HEAD>
    <BODY>
    <DIV>
    <DIV><FONT size=3D2>Date: 28.05.05</FONT></DIV>
    <DIV>
    <P><FONT size=3D2>Chennai(Nungambakkam)<SPAN=20
    class=3D234012805-03062005>,</SPAN><SPAN =
    class=3D812480109-13062005>40</SPAN>.0<SPAN=20
    class=3D234012805-03062005>;</SPAN></FONT></P>
    <P><SPAN class=3D234012805-03062005></SPAN><FONT =
    size=3D2>Chennai(Meenambakkam)<SPAN=20
    class=3D234012805-03062005>,</SPAN><SPAN =
    class=3D812480109-13062005>40</SPAN>.8<SPAN=20
    class=3D234012805-03062005>;</SPAN></FONT></P>
    <P><FONT size=3D2>Nagapattinam<SPAN =
    class=3D234012805-03062005>,</SPAN>3<SPAN=20
    class=3D812480109-13062005>7</SPAN>.<SPAN =
    class=3D812480109-13062005>0</SPAN><SPAN=20
    class=3D234012805-03062005>;</SPAN></FONT></P></DIV></DIV></BODY></HTML>

    ------=_NextPart_000_0001_01C57024.B0B606A0--

    Here email is in HTML format.

    Body of the message is hardly 5 to 7 lines which is in Blue Back Ground.

    So, how to get body of the message only, I am using Vb .Net 2002.

    Thanks

    Monday, June 27, 2005 9:55 AM
  • Well..you cannot get the body alone from a POP server...and i cannot agree the header and footer as junk.

    You can parse the text and get the body alone..you can do this by first extracting the text between the boundaries..

    ------=_NextPart_000_0001_01C57024.B0B606A0
    Content-Type: text/plain;
     charset="us-ascii"
    Content-Transfer-Encoding: 7bit

    Date: 28.05.05

    Chennai(Nungambakkam),40.0;

    Chennai(Meenambakkam),40.8;

    Nagapattinam,37.0;


    ------=_NextPart_000_0001_01C57024.B0B606A0

    and then you can easily get the body(for plain text)

    Suresh.


    Tuesday, June 28, 2005 10:34 AM
  • Hi suresh,

    Thanks for reply.

    As you said that we can extract the mail using Boundries. But mail format which other mail server are using is very different.

    for example.
    Hotmail:
    Return-Path: <
    tumbalam@hotmail.com>
    Delivered-To:
    genevalert@genevafinepunch.com
    Received: (qmail 11754 invoked by alias); 29 Jun 2005 06:35:23 -0000
    Received: (qmail 11745 invoked by uid 504); 29 Jun 2005 06:35:23 -0000
    Received: from
    tumbalam@hotmail.com by rainmail.genevafinepunch.com by uid 3005 with qmail-scanner-1.21
     (fireav: ???.  Clear:RC:1(127.0.0.1):.
     Processed in 0.017273 secs); 29 Jun 2005 06:35:23 -0000
    Received: from 66.179.181.156 [66.179.181.156]
     by localhost with POP3 (fetchmail-6.2.2)
     for
    mailservice@localhost (single-drop); Wed, 29 Jun 2005 12:05:22 +0530 (IST)
    Received: from hotmail.com (bay20-f33.bay20.hotmail.com [64.4.54.122])
     by carizen.getcloser.net (Postfix) with ESMTP id DD9678E41E0
     for <
    alert@genevasoftech.com>; Wed, 29 Jun 2005 13:28:33 +0700 (GMT-7)
    Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC;
      Tue, 28 Jun 2005 23:28:23 -0700
    Message-ID: <
    BAY20-F33EC2C83F51D37D26AE485C0E00@phx.gbl>
    Received: from 61.95.205.56 by by20fd.bay20.hotmail.msn.com with HTTP;
     Wed, 29 Jun 2005 06:28:22 GMT
    X-Originating-IP: [61.95.205.56]
    X-Originating-Email: [tumbalam@hotmail.com]
    X-Sender:
    tumbalam@hotmail.com
    From: "anil kumar" <tumbalam@hotmail.com>
    To:
    alert@genevasoftech.com
    Subject: Temp-Hotmail
    Date: Wed, 29 Jun 2005 06:28:22 +0000
    Mime-Version: 1.0
    Content-Type: text/html; format=flowed
    X-OriginalArrivalTime: 29 Jun 2005 06:28:23.0517 (UTC) FILETIME=[C00E40D0:01C57C73]
    X-UIDL: C\1!!I\S!!'gY!!S>m"!
    Status: RO

    <html><div style='background-color:'><P>Date: 29.06.05</P>
    <P>Chennai(Nungambakkam),40.0;</P>
    <P>Chennai(Meenambakkam),40.8;</P>
    <P>Nagapattinam,37.0;</P></div><br clear=all><hr>44 Million Items on Sale.What Are you Looking for? <a href="
    http://g.msn.com/8HMAENIN/2740??PS=47575" target="_top">Find it on eBay.in!</a> </html>

    Yahoo.
    Return-Path: <
    iloveuanil@yahoo.com>
    Delivered-To:
    genevalert@genevafinepunch.com
    Received: (qmail 9849 invoked by alias); 29 Jun 2005 06:25:22 -0000
    Received: (qmail 9840 invoked by uid 504); 29 Jun 2005 06:25:22 -0000
    Received: from
    iloveuanil@yahoo.com by rainmail.genevafinepunch.com by uid 3005 with qmail-scanner-1.21
     (fireav: ???.  Clear:RC:1(127.0.0.1):.
     Processed in 0.017437 secs); 29 Jun 2005 06:25:22 -0000
    Received: from 66.179.181.156 [66.179.181.156]
     by localhost with POP3 (fetchmail-6.2.2)
     for
    mailservice@localhost (single-drop); Wed, 29 Jun 2005 11:55:22 +0530 (IST)
    Received: from web33309.mail.mud.yahoo.com (web33309.mail.mud.yahoo.com [68.142.206.124])
     by carizen.getcloser.net (Postfix) with SMTP id 0A06D8E41AC
     for <
    alert@genevasoftech.com>; Wed, 29 Jun 2005 13:19:51 +0700 (GMT-7)
    Received: (qmail 87962 invoked by uid 60001); 29 Jun 2005 06:19:40 -0000
    DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
      s=s1024; d=yahoo.com;
      h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding;
      b=ZtiPiWnNHV1f1AQKfISBYLspy8mKKvqCBDESqZtz8WXM75gbkQwW78DNtgSujJ5mbcqLDDKLRNIawe/zNbOMY853aXF+NNXzwiopUQS/NMHt3BxtzuDY3ruEVFJzGDXGp6BmTYJHa4S2/x16Dt19aCspMhYudZYoJqSUAmKgFOE=  ;
    Message-ID: <
    20050629061940.87960.qmail@web33309.mail.mud.yahoo.com>
    Received: from [61.95.205.56] by web33309.mail.mud.yahoo.com via HTTP; Tue, 28 Jun 2005 23:19:40 PDT
    Date: Tue, 28 Jun 2005 23:19:40 -0700 (PDT)
    From: TUmbalam Anil Kumar <
    iloveuanil@yahoo.com>
    Subject: Temp
    To:
    alert@genevasoftech.com
    MIME-Version: 1.0
    Content-Type: text/plain; charset=iso-8859-1
    Content-Transfer-Encoding: 8bit
    X-UIDL: T?o"!]%<"!"g&!!\UA!!
    Status: R

    Date: 28.05.05

    Chennai(Nungambakkam),40.0;

    Chennai(Meenambakkam),40.8;

    Nagapattinam,37.0;

     

    __________________________________________________
    Do You Yahoo!?
    Tired of spam?  Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com

    Some other site:
    Return-Path: <
    anil@xxxxxxxxxxx.com>
    Delivered-To:
    genevalert@xxxxxxxxxxx.com
    Received: (qmail 9996 invoked by alias); 29 Jun 2005 06:28:58 -0000
    Received: (qmail 9990 invoked by uid 504); 29 Jun 2005 06:28:56 -0000
    Received: from
    anil@xxxxxxxxxxx.com by rainmail.xxxxxxxxxxx.com by uid 501 with qmail-scanner-1.21
     (fireav: ???.  Clear:RC:0(192.168.2.11):.
     Processed in 0.158046 secs); 29 Jun 2005 06:28:56 -0000
    Received: from unknown (HELO anil) (
    genevanil@192.168.2.11)
      by softdnserror with SMTP; 29 Jun 2005 06:28:56 -0000
    Reply-To: <
    anil@xxxxxxxxxxx.com>
    From: "Tumbalam Anil Kumar" <
    anil@xxxxxxxxxxx.com>
    To: <
    alert@xxxxxxxxxxx.com>
    Subject: Temp
    Date: Wed, 29 Jun 2005 11:46:31 +0530
    Organization: Geneva Software Technologies
    Message-ID: <
    000001c57c72$2669a1a0$0b02a8c0@xxxxxxxxxxx.com>
    MIME-Version: 1.0
    Content-Type: multipart/alternative;
     boundary="----=_NextPart_000_0001_01C57CA0.4021DDA0"
    X-Priority: 3 (Normal)
    X-MSMail-Priority: Normal
    X-Mailer: Microsoft Outlook, Build 10.0.2616
    Importance: Normal
    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478
    Status:  

    This is a multi-part message in MIME format.

    ------=_NextPart_000_0001_01C57CA0.4021DDA0
    Content-Type: text/plain;
     charset="us-ascii"
    Content-Transfer-Encoding: 7bit

    Date: 27.06.05
     
    Chennai(Nungambakkam),40.0;
     
    Chennai(Meenambakkam),40.8;
     
    Nagapattinam,37.0;
     


    ------=_NextPart_000_0001_01C57CA0.4021DDA0
    Content-Type: text/html;
     charset="us-ascii"
    Content-Transfer-Encoding: quoted-printable

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
    charset=3Dus-ascii">
    <TITLE>Message</TITLE>

    <META content=3D"MSHTML 6.00.2800.1498" name=3DGENERATOR></HEAD>
    <BODY>
    <DIV><FONT face=3D"Trebuchet MS" size=3D2>Date:&nbsp;<SPAN=20
    class=3D718521206-29062005>27</SPAN>.0<SPAN=20
    class=3D718521206-29062005>6</SPAN>.05</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3D"Trebuchet MS" =
    size=3D2>Chennai(Nungambakkam),40.0;</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3D"Trebuchet MS" =
    size=3D2>Chennai(Meenambakkam),40.8;</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3D"Trebuchet MS" =
    size=3D2>Nagapattinam,37.0;</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV align=3Dleft><FONT face=3D"Trebuchet MS" size=3D2><BR><BR>

    ------=_NextPart_000_0001_01C57CA0.4021DDA0--


    So its very hard to find out where the boundries.

    thanks....

     

    Wednesday, June 29, 2005 6:51 AM
  • I'm not sure whether yahoo or hotmail supports POP3.

    Suresh.
    Wednesday, June 29, 2005 10:43 AM
  •  

    Hi Anil,

    We are looking for software developers. If interested, kindly revert me back.

     

    Thanks,

    Varsha K

    Saturday, June 12, 2010 12:56 PM