Announcement

Collapse
No announcement yet.

POP3 Parsing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • POP3 Parsing

    Hi Guys,

    Could anybody please show me a sample code of how to parse the body of an email. Plain Text, Rich Text, and HTML with and without attachment.

    Thanks
    Last edited by Gary Domantay; 26 Jan 2009, 03:29 AM.

  • #2
    Hi Gary,
    This should get you started:

    http://www.powerbasic.com/files/pub/docs/gazette/ See Gazzette No.19 - Sending E-Mail With PB/DLL.

    \Samples\Internet\Smtp\Smtp.bas - email (SMTP) example for PowerBASIC for Windows.

    Borje Hagsten's test program showing how to connect to a POP3 server and download mail data. http://www.powerbasic.com/support/do...files/POP3.zip
    Rgds, Dave

    Comment


    • #3
      Hi Gary;

      In your Samples folder there's a compilable SMTP program. It should serve as a starting point.

      Comment


      • #4
        Hi Guys,

        First of all, I want to thank you for your replies. I have already created a utility to send and recieve emails but what I want to know is how to parse incoming emails to segragate the sections of the email; that is, the headers (Return Path, From, To, Cc, etc..), body, attachments.

        The headers seems straightforward. The body if it is a plain text (Content-Type: text/plain) I think the body starts after the first empty line (TCP LINE nTCP, Buffer: if Buffer=""). But, if the Content-Type is a multipart that is not the case, right? Parts are separated by boundaries (e.g. ------=_NextPart_000_0000_01C9812C.039AA3A0--) and it may contain more that one delimiter in case there are attachments.

        Comment


        • #5
          If there are attachments the header should contain a line like "Content-Type: multipart/mixed; boundary=" the defined boundary remains the same throughout the email but is preceded with -- the lines following a boundary line up to the first blank line will describe the content type and encoding if any. I seem to remember the MS website has a list of the standard ones they use.
          Simple way to find most is to write a simple pop3 client that just dumps the entire text to a file and then send it an email with a bunch of different types of attachments from outlook or hotmail or yahoo mail etc and have a look at what you get.

          Comment

          Working...
          X