Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Line Break

Line Break

Scheduled Pinned Locked Moved C#
questioncsharpcomannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goatstudio
    wrote on last edited by
    #1

    I developed a C# apps to retrieve pop3 email, the result I got is something like below: Return-Path: Delivered-To: user@main.com Received: (qmail 55301 invoked by uid 89); 3 Nov 2004 00:07:53 +0800 Message-ID: <20041102160753.55300.user@main.com> From: "Victor Tai" To: user@main.com Subject: Email Extream Test 11 Date: Wed, 03 Nov 2004 00:07:53 +0800 Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8" Content-Transfer-Encoding: 7bit How do I separate them into line so that I can get the variable like From, To, Subject? I try to identify by "\n", but it gave me wrong result... Thanks.

    K 1 Reply Last reply
    0
    • G goatstudio

      I developed a C# apps to retrieve pop3 email, the result I got is something like below: Return-Path: Delivered-To: user@main.com Received: (qmail 55301 invoked by uid 89); 3 Nov 2004 00:07:53 +0800 Message-ID: <20041102160753.55300.user@main.com> From: "Victor Tai" To: user@main.com Subject: Email Extream Test 11 Date: Wed, 03 Nov 2004 00:07:53 +0800 Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8" Content-Transfer-Encoding: 7bit How do I separate them into line so that I can get the variable like From, To, Subject? I try to identify by "\n", but it gave me wrong result... Thanks.

      K Offline
      K Offline
      kayhustle
      wrote on last edited by
      #2

      You should use regular expressions, which are stored in System.Text.RegularExpressions namespace. For example string header = (Your header),match=""; Regex r = new Regex("Subject:.*"); Match m=r.Match(header); if(m.Success){ match = m.Value; } Now match contains the line beginning with "Subject:".

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups