Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9271403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:36:41+00:00 2026-06-18T15:36:41+00:00

I have to read mails which is send by send grid through c# code.

  • 0

I have to read mails which is send by send grid through c# code.

I have read the stream which is like that

     --xYzZY
Content-Disposition: form-data; name="headers"

Received: by 127.0.0.1 with SMTP id 8KwcWqETbu Fri, 25 Jan 2013 03:49:42 -0600 (CST)
Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx5.sendgrid.net (Postfix) with ESMTPS id A1D5A2621B68 for <pk@replydev.socialboards.com>; Fri, 25 Jan 2013 03:49:42 -0600 (CST)
Received: by mail-ve0-f173.google.com with SMTP id b10so69883vea.32 for <pk@replydev.socialboards.com>; Fri, 25 Jan 2013 01:49:42 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=w5qN+xkC2AsH6lrtfF/wYnPJ3C3PTO0oVvChHKiLsXM=; b=hgrflJqveG6cOlK5XNz7qI3fJjIOvOeJsmZhyPU+vRFsKlLPctb91oGxz/0v+kzABj us04rC6cW6CWIIR4W1dYfUEpXYdBgbVoOMPs4ef005jMHPOfpMx81YAW6tpq1HQyLh1W 4n49LBm1GssCJhbhwSMUKRwIVqBmLtxMzVPnWVrCqMB8e2KSn78yw58JFOtf7qv+tKE3 oqa4n04ywmcVCKhEx2bhIvpo7IJQ5BjC62Q3iNdQgTJLw1eKQ9nMF8BTxXLFlFZK5HHb fpLFkgiIGqqYJioKtyS0slkJQA1P8OSrjkDnlmLXJU7btatnxd+a94wYKNB6yHwYpL+M f4SQ==
MIME-Version: 1.0
X-Received: by 10.52.179.136 with SMTP id dg8mr4231328vdc.81.1359107382079; Fri, 25 Jan 2013 01:49:42 -0800 (PST)
Received: by 10.58.155.42 with HTTP; Fri, 25 Jan 2013 01:49:42 -0800 (PST)
Date: Fri, 25 Jan 2013 15:19:42 +0530
Message-ID: <CAJfhHSq2qTRHK_0_6jWQyTd9ecB61SJYDyy8mM7G3-atUN13qA@mail.gmail.com>
Subject: dfdsfdsfds
From: Pragati Kumar <pragati.kumar@sdplabs.com>
To: Eric Test <pk@replydev.socialboards.com>
Content-Type: multipart/alternative; boundary=bcaec5014c15b870c904d419d845
X-Gm-Message-State: ALoCoQmTr/zLwW3mbRCZRyL5EOYaPnPrpXB+GEtN+sTQ1PdGB/ulN//n2SaQiYaSbKRyVaqLJfBq

--xYzZY
Content-Disposition: form-data; name="dkim"

none
--xYzZY
Content-Disposition: form-data; name="to"

Eric Test <pk@replydev.socialboards.com>
--xYzZY
Content-Disposition: form-data; name="html"

<div dir="ltr"><br clear="all"><div style>fdsfdsfdsfdsfdsfds</div>-- <br><div dir="ltr"><div>Thanks With Regards.</div><div><br></div><div><b>Pragati Kumar Singh</b></div><div><b>Software Developer (.NET)</b></div><div><b>Mob:  +91 902-363-6285</b></div>
<div><b><br></b></div><div><b>SDPLabs</b></div><div><b><a href="mailto:pragati.kumar@sdplabs.com" target="_blank">pragati.kumar@sdplabs.com</a></b></div><div><b><a href="http://www.sdplabs.com" target="_blank">www.sdplabs.com</a></b></div>
<div><br></div><div>India:  +91 0172 401 0125 (Office)</div><div>           +91 0172 465 0337 (Office)</div><div>USA:   +1 646-462-4634 (Office)</div><div>           +1 646-789-5302 (Cell)</div><div>Fax:   +1 928-563-1783</div>
</div>
</div>

--xYzZY
Content-Disposition: form-data; name="from"

Pragati Kumar <pragati.kumar@sdplabs.com>
--xYzZY
Content-Disposition: form-data; name="text"

fdsfdsfdsfdsfdsfds
-- 
Thanks With Regards.

*Pragati Kumar Singh*
*Software Developer (.NET)*
*Mob:  +91 902-363-6285*
*
*
*SDPLabs*
*pragati.kumar@sdplabs.com*
*www.sdplabs.com*

India:  +91 0172 401 0125 (Office)
           +91 0172 465 0337 (Office)
USA:   +1 646-462-4634 (Office)
           +1 646-789-5302 (Cell)
Fax:   +1 928-563-1783

--xYzZY
Content-Disposition: form-data; name="spam_report"

Spam detection software, running on the system "mx5.sendgrid.net", has
identified this incoming email as possible spam.  The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email.  If you have any questions, see
the administrator of that system for details.

Content preview:  fdsfdsfdsfdsfdsfds -- Thanks With Regards. *Pragati Kumar
  Singh* *Software Developer (.NET)* *Mob:  +91 902-363-6285* * * *SDPLabs* *pragati.kumar@sdplabs.com*
   *www.sdplabs.com* India:  +91 0172 401 0125 (Office)  +91 0172 465 0337 (Office)
   USA:  +1 646-462-4634 (Office)  +1 646-789-5302 (Cell) Fax: +1 928-563-1783
   [...] 

Content analysis details:   (-0.7 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 0.0 HTML_MESSAGE           BODY: HTML included in message
-0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
                            trust
                            [209.85.128.173 listed in list.dnswl.org]
 0.0 T_MIME_NO_TEXT         No text body parts


--xYzZY
Content-Disposition: form-data; name="envelope"

but I am unable verify its format so that it could be inserted into our database.
Please help to decode it so that I can read the following fields in the best possible way.
1. To
2. From
3. BCC
4. Body
5. Subject
6. Attachment.

Thanks in anticipation


{"to":["pk@replydev.socialboards.com"],"from":"pragati.kumar@sdplabs.com"}
--xYzZY
Content-Disposition: form-data; name="attachments"

0
--xYzZY
Content-Disposition: form-data; name="subject"

dfdsfdsfds
--xYzZY
Content-Disposition: form-data; name="spam_score"

-0.689
--xYzZY
Content-Disposition: form-data; name="charsets"

{"to":"UTF-8","html":"ISO-8859-1","subject":"UTF-8","from":"UTF-8","text":"ISO-8859-1"}
--xYzZY
Content-Disposition: form-data; name="SPF"

none
--xYzZY--

I have to serialize this into json format.

I have tried

 private string RequestInputStreamToString()
    {
        System.Text.StringBuilder sb = new StringBuilder();
        int streamLength;
        int streamRead;
        System.IO.Stream s = HttpContext.Current.Request.InputStream;
        streamLength = Convert.ToInt32(s.Length);
        Byte[] streamArray = new Byte[streamLength];
        streamRead = s.Read(streamArray, 0, streamLength);
        for (int i = 0; i < streamLength; i++)
        {
            sb.Append(Convert.ToChar(streamArray[i]));
        }
       return sb.ToString();
    }
 string jsontext =RequestInputStreamToString();
 var json = JObject.Parse(jsontext);

But it is thronging error

Error reading JObject from JsonReader.

for more reference please check http://sendgrid.com/docs/API_Reference/Webhooks/parse.html
but it is given in php and I want in C#

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:36:42+00:00Added an answer on June 18, 2026 at 3:36 pm

    After the hard time I find out the solution.
    These are the content of multipart/form-data.
    Each and every data can be read through

        HttpContext context;
        String to=context.Request.Params["to"];
        String from=context.Request.Params["from"];
        String html=context.Request.Params["html"];
            .......etc..............
    

    After reading its content and node it can be passed to class properties and further it can be serialized into json or xml as per yours requirement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an iOS app through which user can read and send messages
I have read Gdk forum link which says that getting num lock state api
I have like 50 different php files which all use the mail function. After
I have to read IPM note and get the following 2 information 1)who send
I have a use case where i need to read the content of the
I have developed web application which is reading mails from Gmail IMAP server and
I have a basic PHP mail() script which e-mails users the details of a
I have the following PHP file which is used to send a simple email,
I have a utility app. I've implemented this code on the flipside, which calls
I have drawn up the following PHP code which processes the data from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.